Renders a widget's item.
@param string|array $item the item to render.
@return string the rendering result.
@throws InvalidConfigException
766248
public function renderItem($item)
    {
        if (is_string($item)) {
            return $item;
        }
        if (!isset($item['label'])) {
            throw new InvalidConfigException("The 'label' option is required.");
        }
        $encodeLabel = isset($item['encode']) ? $item['encode'] : $this->encodeLabels;
        $label = $encodeLabel ? Html::encode($item['label']) : $item['label'];
        $options = ArrayHelper::getValue($item, 'options', ['class'=>'btn btn-sm']);
        $url = ArrayHelper::getValue($item, 'url', '#');

        if (isset($item['active'])) {
            $active = ArrayHelper::remove($item, 'active', false);
        } else {
            $active = $this->isItemActive($item);
        }

        if ($active) {
            Html::addCssClass($options, 'btn-info');
        } else {
            Html::addCssClass($options, 'btn-default');
        }

        return Html::a($label, $url, $options);
    }
847906
public function add ($item) {
        if ($this->name === null) {
            throw new InvalidConfigException(get_class ($this) . " requires a name!");
        }
        if (!$this->getConnection ()->getClient ()->rpush ($this->name , $item)) {
            return false;
        }
        $this->_data = null;
        $this->_count = null;
        return true;
    }
650598
protected function renderItem($item)
	{
		if (isset($item['url'])) {
			if($this->useSprites) {
				$spriteUrl = $this->spriteUrl;
				$item['template'] = "<a href=\"{url}\" style=\"background: no-repeat 0 {$this->itemOffset}px url($spriteUrl);\">{label}</a>";
				$this->itemOffset -= 16;
			} else {
				$components = parse_url($item['url']);
				$iconUrl = $this->iconizerBaseUrl . $components['host'];
				$item['template'] = "<a href=\"{url}\" style=\"background: no-repeat url($iconUrl)\">{label}</a>";
			}
		}
		return parent::renderItem($item);
	}
108576
public function renderItems()
    {
        $items = [];
        foreach ($this->items as $item) {
            $options = $this->itemOptions;
            $tag = ArrayHelper::remove($options, 'tag', 'li');
            if (is_array($item)) {
                if (!array_key_exists('content', $item)) {
                    throw new InvalidConfigException("The 'content' option is required.");
                }
                $options = array_merge($options, ArrayHelper::getValue($item, 'options', []));
                $tag = ArrayHelper::remove($options, 'tag', $tag);
                $items[] = Html::tag($tag, $item['content'], $options);
            } else {
                $items[] = Html::tag($tag, $item, $options);
            }
        }
        return implode("\n", $items);
    }
1273691
protected function renderItem($item)
    {
        $this->validateItems($item);
        $template = ArrayHelper::getValue($item, 'template', $this->linkTemplate);
        $url = Url::to(ArrayHelper::getValue($item, 'url', '#'));
        if (empty($item['top'])) {
            if (empty($item['items'])) {
                $template = str_replace('{icon}', $this->indItem . '{icon}', $template);
            } else {
                $template = '<a href="{url}" class="kv-toggle">{icon}{label}</a>';
                $openOptions = ($item['active']) ? ['class' => 'opened'] : ['class' => 'opened', 'style' => 'display:none'];
                $closeOptions = ($item['active']) ? ['class' => 'closed', 'style' => 'display:none'] : ['class' => 'closed'];
                $indicator = Html::tag('span', $this->indMenuOpen, $openOptions) . Html::tag('span', $this->indMenuClose, $closeOptions);
                $template = str_replace('{icon}', $indicator . '{icon}', $template);
            }
        }
        $icon = empty($item['icon']) ? '' : '<span class="' . $this->iconPrefix . $item['icon'] . '"></span> &nbsp;';
        unset($item['icon'], $item['top']);
        return strtr($template, [
            '{url}' => $url,
            '{label}' => $item['label'],
            '{icon}' => $icon
        ]);
    }
1079564
public function addItem($item)
    {
        if (!is_numeric($item)) {
            throw new \InvalidArgumentException(sprintf("Value '%s' must be a numeric value", $item));
        }

        $this->items[] = $item;

        return $this;
    }
1101314
public function render_item(\templatable $item) {
        $data = $item->export_for_template($this);

        return $this->render_from_template('block_rss_client/item', $data);
    }
500953
public function getWidgetItem(array $item) {
        $entity = new ItemWidget();

        $entity->setName($this->getItemName($item));
        $entity->setLink($this->browser->getHost().$item['url']);
        $entity->setCover($this->browser->getHost().$item['image']['original']);

        $catalog_item = $this->getCatalogItem($item);
        if ($catalog_item instanceof Item) {
            $entity->setItem($catalog_item);
        } elseif ($this->filler instanceof Filler) {
            $entity->setLinkForFill($this->filler->getLinkForFill($entity->getLink()));
        }

        return $entity;
    }
337866
protected function getRenderedItem($item) {

        //@todo make getRenderedItem language dependent
        $lang = \common_session_SessionManager::getSession()->getDataLanguage();
        $qtiItem = Service::singleton()->getDataItemByRdfItem($item, $lang, true);
        if ($qtiItem) {
            $contentVariableElements = array_merge($this->getModalFeedbacks($qtiItem), $this->getRubricBlocks($qtiItem));

            /** @var AssetService $assetService */
            $assetService = ServiceManager::getServiceManager()->get(AssetService::SERVICE_ID);

            $taoBaseUrl = $assetService->getJsBaseWww( 'tao' );
            $qtiBaseUrl = $assetService->getJsBaseWww( 'taoQtiItem' );

            $taoLibUrl = $taoBaseUrl.'js/';
            $taoQtiItemLibUrl = $qtiBaseUrl.'js/';

            $xhtml = $qtiItem->toXHTML(array(
                'contentVariableElements' => $contentVariableElements,
                //  'js' => array($qtiBaseUrl.'js/preview/qtiViewSelector.js'),
                'js_var' => array('view' => $this->getRequestView()),
                // 'css' => array($qtiBaseUrl.'css/preview/qtiViewSelector.css'),
                'path' => array(
                    'tao' => $taoLibUrl,
                    'taoQtiItem' => $taoQtiItemLibUrl
                ),
                'client_config_url' => $this->getClientConfigUrl()

            ));
        } else {
            \common_Logger::i('Try to preview an empty item', [$item->getUri()]);
            $xhtml = '';
        }

        return $xhtml;
    }
943566
public static function prepareItems($items)
    {
        if (!is_array($items)) {
            throw new InvalidConfigException(Yii::t('app', 'List items should be an array.'));
        }
        if (isset($items['class']) && isset($items['method'])) {
            return call_user_func([$items['class'], $items['method']]);
        } else {
            return $items;
        }
    }
615502
public function render($item = -1)
	{
		if (!$this->isEnabled()) {
			return;
		}

		return $this->view->make('googlmapper::mapper')
			->withView($this->view)
			->withOptions($this->generateRenderOptions($item))
			->withItems($item > -1 ? [$item => $this->getItem($item)] : $this->getItems())
			->render();
	}
904825
protected function renderItem($item)
    {
        if (is_string($item)) {
            return $item;
        }
        if (!isset($item['label'])) {
            throw new InvalidConfigException("The 'label' option is required.");
        }
        $label       = $this->encodeLabels ? \CHtml::encode($item['label']) : $item['label'];
        $options     = ArrayHelper::getValue($item, 'options', array());
        $items       = ArrayHelper::getValue($item, 'items');
        $url         = \CHtml::normalizeUrl(ArrayHelper::getValue($item, 'url', '#'));
        $linkOptions = ArrayHelper::getValue($item, 'linkOptions', array());

        if (ArrayHelper::getValue($item, Enum::STATE_ACTIVE)) {
            ArrayHelper::addValue('class', Enum::STATE_ACTIVE, $options);
        }

        if ($items !== null) {
            Html::addCssClass($options, Enum::DROPDOWN_HAS);
            if (is_array($items)) {
                $items = Nav::dropdown($items, $this->encodeLabels);
            }
        }

        return \CHtml::tag('li', $options, \CHtml::link($label, $url, $linkOptions) . $items);
    }
1271150
protected function prepareCartItem(array &$item)
    {
        $this->setItemImages($item['product'], 'product', $this->image);
        $this->setItemThumbCart($item, $this->image);
        $this->setItemPriceFormatted($item, $this->price, $this->current_currency);
        $this->setItemTotalFormatted($item, $this->price);
        $this->setItemProductBundle($item['product'], $this->product, $this->image);
    }
245109
public function render(ItemInterface $item, array $options = array())
    {
        $options = array_merge($this->defaultOptions, $options);

        $template = $options['template'];
        if (!$template instanceof \Twig_Template) {
            $template = $this->environment->loadTemplate($template);
        }

        $data = $this->getData($item);

        $html = $template->renderBlock($options['block'], array(
            'item'    => $data,
            'options' => $options,
            'matcher' => $this->matcher
        ));

        if (!empty($options['clear_matcher'])) {
            $this->matcher->clear();
        }

        return $html;
    }
659256
protected function renderItems($items, $options = [])
    {
        $lines = [];
        foreach ($items as $item) {
            if (is_string($item)) {
                $lines[] = $item;
                continue;
            }
            if (isset($item['visible']) && !$item['visible']) {
                continue;
            }
            if (!array_key_exists('label', $item)) {
                throw new InvalidConfigException("The 'label' option is required.");
            }
            $encodeLabel = isset($item['encode']) ? $item['encode'] : $this->encodeLabels;
            $label = $encodeLabel ? Html::encode($item['label']) : $item['label'];
            $itemOptions = ArrayHelper::getValue($item, 'options', []);
            $linkOptions = ArrayHelper::getValue($item, 'linkOptions', []);
            $linkOptions['tabindex'] = '-1';
            $url = array_key_exists('url', $item) ? $item['url'] : null;
            if (empty($item['items'])) {
                if ($url === null) {
                    $content = $label;
                    Html::addCssClass($itemOptions, ['widget' => 'dropdown-header']);
                } else {
                    $content = Html::a($label, $url, $linkOptions);
                }
            } else {
                $submenuOptions = $this->submenuOptions;
                if (isset($item['submenuOptions'])) {
                    $submenuOptions = array_merge($submenuOptions, $item['submenuOptions']);
                }
                $content = Html::a($label, $url === null ? '#' : $url, $linkOptions)
                    . $this->renderItems($item['items'], $submenuOptions);
                Html::addCssClass($itemOptions, ['widget' => 'dropdown-submenu']);
            }

            $lines[] = Html::tag('li', $content, $itemOptions);
        }

        return Html::tag('ul', implode("\n", $lines), $options);
    }
969098
protected function convertItem($item)
    {
        foreach ($item as $key => $value) {
            if (!isset($this->converters[$key])) {
                continue;
            }

            foreach ($this->converters[$key] as $converter) {
                $item[$key] = call_user_func($converter, $item[$key]);
            }
        }

        return $item;
    }
500316
protected function renderItemLink($item)
    {
        $url = ArrayHelper::getValue($item, 'url', '#');
        $linkOptions = ArrayHelper::getValue($item, 'linkOptions', []);
        $encodeLabel = ArrayHelper::getValue($item, 'encode', $this->encodeLabels);
        $label = $encodeLabel ? Html::encode($item['label']) : $item['label'];
        $items = ArrayHelper::getValue($item, 'items');

        $bTagHtml = '';
        if ($items !== null) {
            $bTagIcon = Html::tag('i','',['class'=>'fa fa-angle-left pull-right']);
            $bTagHtml = Html::tag('span', $bTagIcon, $this->defaultDropDownBTagOptions);

        }

        $iconHtml = $this->renderItemIcon($item);
        $label = Html::tag('span', $label, ['class' => 'menu-text']);
        return Html::a($iconHtml . $label . $bTagHtml, $url, $linkOptions);

    }