Bruno17 / MIGX

MIGX for revo 2.2 and above
84 stars 78 forks source link

Hello! The migx problem in the renderChunk method was found and fixed. Push to release! #334

Open vitaliy-voropaev opened 5 years ago

vitaliy-voropaev commented 5 years ago

Important! The problem relates to the type Input TV type listbox-multiple. If there are two or more IDs in options. They are passed to the render chunk as an Array, which leads to an error.

Solution below:

function renderChunk($tpl, $properties = array(), $getChunk = true, $printIfemty = true) {
    $propertiestype = array();
    foreach ($properties as $key => $prop) {
        if (is_array($prop) && count($prop) > 0) {
            $propertiestype[$key] = implode(',',$prop);
        } else {
            $propertiestype[$key] = $prop;
        }
    }
    $properties = $propertiestype;

    $value = $this->parseChunk($tpl, $properties, $getChunk, $printIfemty);

    $this->modx->getParser();
    /*parse all non-cacheable tags and remove unprocessed tags, if you want to parse only cacheable tags set param 3 as false*/
    $this->modx->parser->processElementTags('', $value, true, true, '[[', ']]', array());

    return $value;
}

Do not thank!