/** * Renders magellan * @return string the resulting tag */ public function renderMagellan() { $list = array(); foreach ($this->items as $item) { $listItem['url'] = '#' . $item['id']; $listItem['label'] = $item['label']; $listItem['itemOptions'] = array('data-magellan-arrival' => $item['id']); $list[] = $listItem; } return \CHtml::tag('div', $this->htmlOptions, Nav::sub($list)); }
/** * Renders a widget's item * @param mixed $item the item to render * @return string the rendering result. * @throws InvalidConfigException */ 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); }