Ejemplo n.º 1
0
 public function renderItems()
 {
     $out = Html::input('hidden', $this->name, $this->value, $this->inputOptions);
     $out .= Html::tag('div', '', ['class' => 'text']);
     $out .= Elements::icon('dropdown');
     $elems = '';
     foreach ($this->items as $item) {
         $elems .= $this->renderItem($item);
     }
     $out .= Html::tag('div', $elems, ['class' => 'menu']);
     return $out;
 }
Ejemplo n.º 2
0
 /**
  * @param array $item
  *
  * @return string
  */
 public function renderTitle($item)
 {
     $options = ArrayHelper::merge($this->titleOptions, ArrayHelper::getValue($item, 'titleOptions', []));
     $encode = ArrayHelper::getValue($options, 'encode', true);
     $title = Elements::icon('dropdown') . ($encode ? Html::encode($item['title']) : $item['title']);
     Html::addCssClass($options, 'title');
     if ($item['active']) {
         Html::addCssClass($options, 'active');
     }
     return Html::tag('div', $title, $options);
 }
Ejemplo n.º 3
0
 /**
  * @param $items
  *
  * @return string
  */
 public function renderMenuPart($items)
 {
     $items = $this->normalizeItems($items, $hasActiveChild);
     $lines = '';
     foreach ($items as $i => $item) {
         Html::addCssClass($item['options'], 'item');
         if ($item['active']) {
             Html::addCssClass($item['options'], 'active');
         }
         if (isset($item['items'])) {
             Html::addCssClass($item['options'], 'ui simple dropdown');
             $item['label'] = $item['label'] . Elements::icon('dropdown') . Html::tag('div', $this->renderMenuPart($item['items']), ['class' => 'menu']);
             $menu = $this->renderItem($item);
         } else {
             $menu = $this->renderItem($item);
         }
         $lines .= $menu;
     }
     return $lines;
 }