Esempio n. 1
0
 /**
  * @param string $position
  * @param array  $args
  * @return string|void
  */
 public function renderPosition($position, $args = array())
 {
     $output = array();
     $_index = 0;
     // get style
     $style = isset($args['style']) ? $args['style'] : 'default';
     $config = $this->_getConfigPosition($position);
     foreach ($config as $index => $data) {
         if ($element = $this->_jbprice->getElement($data['identifier'])) {
             if (!$element->canAccess()) {
                 continue;
             }
             // Backward Compatibility. Delete later.
             if (!is_numeric($index)) {
                 $index = $_index++;
             }
             $data['_layout'] = $this->_layout;
             $data['_position'] = $position;
             $data['_index'] = $index;
             // set params
             $params = array_merge(array('first' => $index == 1, 'last' => $index == count($config) - 1, 'item_template' => $this->_template, 'item_application_id' => $this->_application, 'moduleParams' => $this->_moduleParams), $args, $data);
             if (!$element->hasFilterValue($params)) {
                 continue;
             }
             $attrs = array('id' => 'jbfilter-id-' . $this->_jbprice->identifier . '-' . trim($data['identifier'], '_'), 'class' => array('element-' . strtolower($element->getElementType()), 'element-tmpl-' . (array_key_exists('jbzoo_filter_render', $params) ? $params['jbzoo_filter_render'] : '_auto_')));
             $value = $this->_getRequest($data['identifier']);
             $elementHTML = $this->elementRender($element, $value, $params, $attrs);
             if (empty($elementHTML)) {
                 continue;
             }
             if ($style) {
                 $output[$index] = parent::render('element.jbpricefilter.' . $style, array('element' => $element, 'params' => $params, 'attrs' => $attrs, 'value' => $value, 'config' => $element->config, 'elementHTML' => $elementHTML));
             } else {
                 $output[$index] = $elementHTML;
             }
         }
     }
     return implode(PHP_EOL, $output);
 }