/** * Renders the widget. */ public function run() { // @todo use [[options]] instead of [[containerOptions]] and introduce [[buttonOptions]] before 2.1 release Html::addCssClass($this->containerOptions, ['widget' => 'btn-group']); $options = $this->containerOptions; $tag = ArrayHelper::remove($options, 'tag', 'div'); $this->registerPlugin('button'); return implode("\n", [Html::beginTag($tag, $options), $this->renderButton(), $this->renderDropdown(), Html::endTag($tag)]); }
/** * Generates a bar * @param integer $percent the percentage of the bar * @param string $label, optional, the label to display at the bar * @param array $options the HTML attributes of the bar * @return string the rendering result. */ protected function renderBar($percent, $label = '', $options = []) { $defaultOptions = ['role' => 'progressbar', 'aria-valuenow' => $percent, 'aria-valuemin' => 0, 'aria-valuemax' => 100, 'style' => "width:{$percent}%"]; $options = array_merge($defaultOptions, $options); Html::addCssClass($options, ['widget' => 'progress-bar']); $out = Html::beginTag('div', $options); $out .= $label; $out .= Html::tag('span', \Yii::t('yii', '{percent}% Complete', ['percent' => $percent]), ['class' => 'sr-only']); $out .= Html::endTag('div'); return $out; }
/** * Renders the widget. */ public function run() { $this->registerPlugin('collapse'); return implode("\n", [Html::beginTag('div', $this->options), $this->renderItems(), Html::endTag('div')]) . "\n"; }
/** * Renders the closing tag of the modal body. * @return string the rendering result */ protected function renderBodyEnd() { return Html::endTag('div'); }
/** * @param string|null $label the label or null to use model label * @param array $options the tag options */ protected function renderLabelParts($label = null, $options = []) { $options = array_merge($this->labelOptions, $options); if ($label === null) { if (isset($options['label'])) { $label = $options['label']; unset($options['label']); } else { $attribute = Html::getAttributeName($this->attribute); $label = Html::encode($this->model->getAttributeLabel($attribute)); } } if (!isset($options['for'])) { $options['for'] = Html::getInputId($this->model, $this->attribute); } $this->parts['{beginLabel}'] = Html::beginTag('label', $options); $this->parts['{endLabel}'] = Html::endTag('label'); if (!isset($this->parts['{labelTitle}'])) { $this->parts['{labelTitle}'] = $label; } }
/** * Renders the widget. */ public function run() { $this->registerPlugin('carousel'); return implode("\n", [Html::beginTag('div', $this->options), $this->renderIndicators(), $this->renderItems(), $this->renderControls(), Html::endTag('div')]) . "\n"; }
/** * Renders the widget. */ public function run() { echo "\n" . $this->renderBodyEnd(); echo "\n" . Html::endTag('div'); $this->registerPlugin('alert'); }
/** * Renders the widget. */ public function run() { $tag = ArrayHelper::remove($this->containerOptions, 'tag', 'div'); echo Html::endTag($tag); if ($this->renderInnerContainer) { echo Html::endTag('div'); } $tag = ArrayHelper::remove($this->options, 'tag', 'nav'); echo Html::endTag($tag, $this->options); BootstrapPluginAsset::register($this->getView()); }