/** * @inheritdoc * @throws \yii\base\InvalidConfigException */ public function init() { parent::init(); if ($this->label === null) { $this->label = $this->hasModel() ? $this->model->getAttributeLabel($this->attribute) : ArrayHelper::getValue($this->options, 'label', false); } Html::removeCssClass($this->options, 'ui'); Ui::addCssClasses($this->wrapperOptions, ['ui', 'checkbox']); $this->wrapperOptions['id'] = $this->options['id'] . '-wrapper'; $this->selector = $this->selector ?: '#' . $this->wrapperOptions['id']; }
/** * Generates step element @see http://semantic-ui.com/elements/step.html * * @param array $items the configuration of the steps. The configuration options may include: * - tag, string, optional, the layer tag. Defaults to 'div' * - icon, string, optional, the icon to display on the step * - title, string, optional, the title of the step * - description, string, optional, the description of the step * @param array $options the tag options in terms of name-value pairs * * @return string the generated step tag */ public static function steps($items, $options = []) { $steps = array_map(function ($item) { $icon = ArrayHelper::remove($item, 'icon', ''); $title = ArrayHelper::remove($item, 'title', ''); $description = ArrayHelper::remove($item, 'description'); if (!empty($title)) { $title = Ui::tag('div', $title, ['class' => 'title']); } if (!empty($description)) { $description = Ui::tag('div', $description, ['class' => 'description']); } if (!empty($icon)) { $icon = static::icon($icon); $content = Ui::tag('div', $title . $description, ['class' => 'content']); } else { $content = $title . $description; } return static::step($icon . $content, $item); }, $items); Ui::addCssClasses($options, ['ui', 'steps']); return Ui::tag('div', implode("\n", $steps), $options); }
/** * Initializes the widget options */ public function initOptions() { Ui::addCssClasses($this->options, ['ui', 'message']); if (!empty($this->header) && isset($this->header['options'])) { Ui::addCssClass($this->header['options'], 'header'); } if (isset($this->icon)) { Ui::addCssClass($this->options, 'icon'); } }