protected function render_repeater($type, $opening_tag, $condition_contents, $exact_match, $template_contents, $content_vars, $index_in_group) { $Tag = new PerchXMLTag($opening_tag); $out = ''; if (is_array($content_vars) && isset($content_vars[$Tag->id()]) && PerchUtil::count($content_vars[$Tag->id()])) { $limit = $Tag->max() ? $Tag->max() : false; $RepeaterTemplate = new PerchTemplate(false, $this->namespace); $RepeaterTemplate->load($condition_contents); if (PerchUtil::bool_val($Tag->scope_parent())) { $vars_for_repeater = array(); if (PerchUtil::count($content_vars)) { foreach ($content_vars as $key => $val) { if ($key != $Tag->id() && $key != 'itemJSON') { $vars_for_repeater['parent.' . $key] = $val; } } } $vars_for_repeater = array_merge($vars_for_repeater, $content_vars[$Tag->id()]); foreach ($content_vars[$Tag->id()] as &$item) { $item = array_merge($item, $vars_for_repeater); } } $out = $RepeaterTemplate->render_group($content_vars[$Tag->id()], true, $limit); } else { if (strpos($condition_contents, 'perch:noresults')) { $s = '/<perch:noresults[^>]*>(.*?)<\\/perch:noresults>/s'; $count = preg_match_all($s, $condition_contents, $matches, PREG_SET_ORDER); if ($count > 0) { foreach ($matches as $match) { $out .= $match[1]; } } } } return str_replace($exact_match, $out, $template_contents); }