/** * Renders a page button. * You may override this method to customize the generation of page buttons. * @param string $label the text label for the button * @param integer $page the page number * @param string $class the CSS class for the page button. * @param boolean $disabled whether this page button is disabled * @param boolean $active whether this page button is active * @return string the rendering result */ protected function renderPageButton($label, $page, $class, $disabled, $active) { $options = ['class' => $class === '' ? null : $class]; if ($active) { Html::addCssClass($options, $this->activePageCssClass); } if ($disabled) { Html::addCssClass($options, $this->disabledPageCssClass); return Html::tag('li', Html::tag('span', $label), $options); } $linkOptions = $this->linkOptions; $linkOptions['data-page'] = $page; return Html::tag('li', Html::a($label, $this->pagination->createUrl($page), $linkOptions), $options); }
/** * @inheritdoc */ protected function renderFilterCellContent() { if (is_string($this->filter)) { return $this->filter; } $model = $this->grid->filterModel; if ($this->filter !== false && $model instanceof Model && $this->attribute !== null && $model->isAttributeActive($this->attribute)) { if ($model->hasErrors($this->attribute)) { Html::addCssClass($this->filterOptions, 'has-error'); $error = ' ' . Html::error($model, $this->attribute, $this->grid->filterErrorOptions); } else { $error = ''; } if (is_array($this->filter)) { $options = array_merge(['prompt' => ''], $this->filterInputOptions); return Html::activeDropDownList($model, $this->attribute, $this->filter, $options) . $error; } else { return Html::activeTextInput($model, $this->attribute, $this->filterInputOptions) . $error; } } else { return parent::renderFilterCellContent(); } }
/** * Generates a summary of the validation errors. * If there is no validation error, an empty error summary markup will still be generated, but it will be hidden. * @param Model|Model[] $models the model(s) associated with this form * @param array $options the tag options in terms of name-value pairs. The following options are specially handled: * * - header: string, the header HTML for the error summary. If not set, a default prompt string will be used. * - footer: string, the footer HTML for the error summary. * * The rest of the options will be rendered as the attributes of the container tag. The values will * be HTML-encoded using [[\Leaps\Helper\Html::encode()]]. If a value is null, the corresponding attribute will not be rendered. * @return string the generated error summary * @see errorSummaryCssClass */ public function errorSummary($models, $options = []) { Html::addCssClass($options, $this->errorSummaryCssClass); $options['encode'] = $this->encodeErrorSummary; return Html::errorSummary($models, $options); }