/**
  * Renders menu items.
  * @param array $items the menu items to be rendered
  * @return string the rendering result.
  * @throws InvalidConfigException if the label option is not specified in one of the items.
  */
 protected function renderItems($items)
 {
     $lines = [];
     foreach ($items as $i => $item) {
         if (isset($item['visible']) && !$item['visible']) {
             unset($items[$i]);
             continue;
         }
         if (is_string($item)) {
             $lines[] = $item;
             continue;
         }
         if (!isset($item['label'])) {
             throw new InvalidConfigException("The 'label' option is required.");
         }
         $label = $this->encodeLabels ? Html::encode($item['label']) : $item['label'];
         $options = ArrayHelper::getValue($item, 'options', []);
         $linkOptions = ArrayHelper::getValue($item, 'linkOptions', []);
         $linkOptions['tabindex'] = '-1';
         $content = Html::a($label, ArrayHelper::getValue($item, 'url', '#'), $linkOptions);
         if (isset($item['items'])) {
             Html::addCssClass($options, 'has-dropdown');
             $content .= FoundationNavDropDown::widget(['items' => $item['items']]);
         }
         $lines[] = Html::tag('li', $content, $options);
     }
     return Html::tag('ul', implode("\n", $lines), $this->options);
 }
 /**
  * Renders a widget's item.
  * @param string|array $item the item to render.
  * @return string the rendering result.
  * @throws InvalidConfigException
  */
 public function renderItem($item)
 {
     if (is_string($item)) {
         return $item;
     }
     if (!isset($item['label'])) {
         VarDumper::dump($item, 10, true);
         throw new InvalidConfigException("The 'label' option is required.");
     }
     $label = $this->encodeLabels ? Html::encode($item['label']) : $item['label'];
     $options = ArrayHelper::getValue($item, 'options', []);
     $items = ArrayHelper::getValue($item, 'items');
     $url = ArrayHelper::getValue($item, 'url', '#');
     $linkOptions = ArrayHelper::getValue($item, 'linkOptions', []);
     if (isset($item['active'])) {
         $active = ArrayHelper::remove($item, 'active', false);
     } else {
         $active = $this->isItemActive($item);
     }
     if ($active) {
         Html::addCssClass($options, 'active');
     }
     if ($items !== null) {
         Html::addCssClass($options, 'has-dropdown');
         if (is_array($items)) {
             $items = FoundationNavDropDown::widget(['items' => $items, 'encodeLabels' => $this->encodeLabels]);
         }
     }
     return Html::tag('li', Html::a($label, $url, $linkOptions) . $items, $options);
 }