Esempio n. 1
0
 /**
  * Generates the rendering of a breadcrumb item
  * @param string $label
  * @param array $options
  */
 public function renderItem($label, $options = array())
 {
     if ($this->tagName === 'nav') {
         $url = ArrayHelper::removeValue($options, 'href', '#');
         $htmlOptions = ArrayHelper::removeValue($options, 'options', array());
         echo \CHtml::openTag('li', $htmlOptions);
         echo \CHtml::link($label, $url);
         echo \CHtml::closeTag('li');
     } else {
         $htmlOptions = ArrayHelper::removeValue($options, 'options', array());
         echo \CHtml::tag('a', array_merge($htmlOptions, $options), $label);
     }
 }
Esempio n. 2
0
 /**
  * Renders the close button.
  * @return string the rendering result
  */
 protected function renderCloseButton()
 {
     if ($this->closeButton !== null) {
         $tag = ArrayHelper::removeValue($this->closeButton, 'tag', 'a');
         $label = ArrayHelper::removeValue($this->closeButton, 'label', '×');
         if ($tag === 'button' && !isset($this->closeButton['type'])) {
             $this->closeButton['type'] = 'button';
         }
         Html::addCssClass($this->closeButton, Enum::DIALOG_CLOSE);
         return \CHtml::tag($tag, $this->closeButton, $label);
     } else {
         return null;
     }
 }
Esempio n. 3
0
 /**
  * Generates a split button.
  * Important: Currently split buttons require the dropdown list items to be rendered before the body tag, so the
  * dropdown list hides on document.click. You will have to click again on dropdown to hide the list.
  * Please, use the button widget for better performance. At the moment, Foundation uses a hack until its new release 4.2
  * @param $label
  * @param $list
  * @param array $htmlOptions
  * @return string
  */
 public static function split($label, $list, $htmlOptions = array())
 {
     $id = Enum::ID_PREFIX . '-' . ++Html::$count;
     ArrayHelper::addValue('class', Enum::DROPDOWN_SPLIT, $htmlOptions);
     $label .= ' <span data-dropdown="' . $id . '"></span>';
     $dropHtmlOptions = ArrayHelper::removeValue($htmlOptions, 'dropHtmlOptions', array());
     $dropHtmlOptions['id'] = $id;
     ArrayHelper::addValue('class', Enum::DROPDOWN_LIST, $dropHtmlOptions);
     ob_start();
     echo '<div style="position:relative">';
     // hack
     echo static::link($label, $htmlOptions);
     echo Dropdown::display(array('items' => $list, 'htmlOptions' => $dropHtmlOptions));
     echo '</div>';
     return ob_get_clean();
 }
Esempio n. 4
0
 /**
  * Initializes the widget
  */
 public function init()
 {
     $this->assets = array('js' => YII_DEBUG ? 'foundation/foundation.orbit.js' : 'foundation.min.js');
     Html::addCssClass($this->htmlOptions, Enum::ORBIT_WRAPPER);
     $this->setId(ArrayHelper::removeValue($this->htmlOptions, 'id', $this->getId()));
     $this->registerClientScript();
     parent::init();
 }