/** * @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); }
/** * @return $this|void */ public function loadAssets() { $this->app->jbassets->less('elements:jbpricecalc/assets/less/jbpricecalc.less'); return parent::loadAssets(); }
/** * @param ElementJBPrice $element * @param string $prefix * @return array */ protected function _getSortJBPriceOptionList($element, $prefix) { $list = array(); $keyPrefix = $prefix . $element->identifier; $elements = $element->getElements(); if (count($elements)) { foreach ($elements as $element) { $type = JString::ucfirst($element->getElementType()); $list[] = $this->_createOption($keyPrefix . '__' . $element->identifier, $element->getName() . ' - ' . $type, false); } } return $list; }
/** * Load assets * @return $this */ public function loadEditAssets() { parent::loadEditAssets(); if ((int) $this->config->get('mode', 1)) { $this->app->jbassets->js('jbassets:js/admin/validator/plain.js'); } return $this; }