/** * Initializes the widget */ public function init() { $this->assets = array('js' => YII_DEBUG ? 'foundation/foundation.joyride.js' : 'foundation.min.js'); Html::addCssClass($this->htmlOptions, Enum::JOYRIDE_LIST); ArrayHelper::addValue('data-joyride', 'data-joyride', $this->htmlOptions); $this->registerClientScript(); parent::init(); }
/** * Initializes the widget */ public function init() { $this->assets = array('js' => YII_DEBUG ? 'foundation/foundation.dropdown.js' : 'foundation.min.js'); Html::addCssClass($this->htmlOptions, Enum::DROPDOWN_LIST); ArrayHelper::addValue('data-dropdown-content', '-', $this->htmlOptions); if ($this->type === Enum::DROPDOWN_CONTENT) { Html::addCssClass($this->htmlOptions, Enum::CONTENT); } parent::init(); }
/** * Widget's initialization */ public function init() { Html::addCssClass($this->htmlOptions, Enum::SWITCH_BUTTON); if ($this->size) { Html::addCssClass($this->htmlOptions, $this->size); } if ($this->radius) { Html::addCssClass($this->htmlOptions, $this->radius); } parent::init(); }
/** * Initializes the widget */ public function init() { $this->assets = array('js' => YII_DEBUG ? 'foundation/foundation.tooltips.js' : 'foundation.min.js'); Html::addCssClass($this->htmlOptions, Enum::TOOLTIP); Html::addCssClass($this->htmlOptions, $this->position); ArrayHelper::addValue('title', $this->tip, $this->htmlOptions); ArrayHelper::addValue('data-tooltip', 'data-tooltip', $this->htmlOptions); if ($this->tip === null || $this->text === null) { throw new InvalidConfigException('"tip" and "text" cannot be null.'); } $this->registerClientScript(); parent::init(); }
/** * Renders a clearing (lightbox) item * @param array $item * @return string the resulting LI tag item */ public function renderItem($item) { $options = ArrayHelper::getValue($item, 'options', array()); if (isset($item['featured'])) { Html::addCssClass($this->htmlOptions, Enum::ClEARING_FEATURE); Html::addCssClass($options, Enum::CLEARING_FEATURE_IMG); } $imgOptions = array(); $imgOptions['src'] = ArrayHelper::getValue($item, 'th', '#'); $imgOptions['data-caption'] = ArrayHelper::getValue($item, 'caption', null); $imgOptions['class'] = 'th'; $url = ArrayHelper::getValue($item, 'img', '#'); return \CHtml::tag('li', $options, \CHtml::link(\CHtml::tag('img', $imgOptions), $url)); }
/** * Initializes the widget * @throws InvalidConfigException */ public function init() { if ($this->source === null) { throw new InvalidConfigException('"source" cannot be null.'); } Html::addCssClass($this->htmlOptions, Enum::VIDEO_FLEXVIDEO); if ($this->widescreen) { Html::addCssClass($this->htmlOptions, Enum::VIDEO_WIDESCREEN); } if ($this->vimeo) { Html::addCssClass($this->htmlOptions, Enum::VIDEO_VIMEO); } parent::init(); }
/** * Renders the alert * @return string the rendering result */ public function renderAlert() { $user = \Yii::app()->user; if (count($user->getFlashes(false)) == 0) { return; } $alerts = array(); foreach ($this->config as $style => $config) { if ($user->hasFlash($style)) { $options = ArrayHelper::getValue($config, 'htmlOptions', array()); Html::addCssClass($options, $style); $close = ArrayHelper::getValue($config, 'close', '×'); $alerts[] = \foundation\helpers\Alert::alert($user->getFlash($style), $options, $close); } } $this->registerEvents("#{$this->htmlOptions['id']} > .alert-box", $this->events); return \CHtml::tag('div', $this->htmlOptions, implode("\n", $alerts)); }
/** * Renders breadcrumbs */ public function renderItems() { if (empty($this->items)) { return; } Html::addCssClass($this->htmlOptions, Enum::BREADCRUMBS); echo \CHtml::openTag($this->tagName, $this->htmlOptions); foreach ($this->items as $label => $options) { $this->renderItem($label, $options); } echo \CHtml::closeTag($this->tagName); }
/** * Generates a button * @param string $label * @param array $htmlOptions * @return string the generated button. */ public static function button($label = 'button', $htmlOptions = array()) { $htmlOptions = ArrayHelper::defaultValue('name', \CHtml::ID_PREFIX . \CHtml::$count++, $htmlOptions); Html::clientChange('click', $htmlOptions); return static::btn('button', $label, $htmlOptions); }
/** * Initializes the widget. */ public function init() { Html::addCssClass($this->htmlOptions, Enum::PAGINATION); parent::init(); }
/** * 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; } }
/** * 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(); }
/** * Renders a section item * @param array $item the section item * @return string the section result */ public function renderItem($item) { $sectionItem = array(); $sectionItem[] = \CHtml::tag('p', array('class' => 'title', 'data-section-title' => 'data-section-title'), \CHtml::link(ArrayHelper::getValue($item, 'label', 'Section Title'), '#')); $options = ArrayHelper::getValue($item, 'options', array()); Html::addCssClass($options, 'content'); ArrayHelper::addValue('data-section-content', 'data-section-content', $options); $sectionOptions = array(); if (ArrayHelper::getValue($item, 'active')) { ArrayHelper::addValue('class', 'active', $sectionOptions); } $sectionItem[] = \CHtml::tag('div', $options, ArrayHelper::getValue($item, 'content', 'Section Content')); return \CHtml::tag('section', $sectionOptions, implode("\n", $sectionItem)); }
/** * 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); }