/** * 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); }
/** * Renders the header (if any) * * @return null|string */ public function renderHeader() { if ($this->header !== false || !empty($this->header)) { $content = ArrayHelper::getValue($this->header, 'label', ''); $options = ArrayHelper::getValue($this->header, 'options', ['class' => 'header']); $header = Ui::tag('div', $content, $options); $lines[] = Ui::beginTag('div', ['class' => 'content']); $lines[] = $header; return implode("\n", $lines); } else { return null; } }