/** * Initializes the detail view widget * * @throws InvalidConfigException */ protected function initWidget() { /** * @var ActiveForm $formClass */ $formClass = $this->formClass; if ($this->enableEditMode) { $activeForm = ActiveForm::classname(); if (!is_subclass_of($formClass, $activeForm) && $formClass !== $activeForm) { throw new InvalidConfigException("Form class '{$formClass}' must exist and extend from '{$activeForm}'."); } $this->validateDisplay(); } if ($this->bootstrap) { Html::addCssClass($this->options, 'table'); if ($this->hover) { Html::addCssClass($this->options, 'table-hover'); } if ($this->bordered) { Html::addCssClass($this->options, 'table-bordered'); } if ($this->condensed) { Html::addCssClass($this->options, 'table-condensed'); } $this->_childTableOptions = $this->options; if ($this->striped) { Html::addCssClass($this->options, 'table-striped'); } } Html::addCssClass($this->_childTableOptions, 'kv-child-table'); Html::addCssClass($this->options, 'detail-view'); Html::addCssStyle($this->labelColOptions, "text-align:{$this->hAlign};vertical-align:{$this->vAlign};"); }
/** * @inheritdoc */ public function init() { if ($this->enableEditMode) { $formClass = $this->formClass; $activeForm = ActiveForm::classname(); if (!is_subclass_of($formClass, $activeForm) && $formClass !== $activeForm) { throw new InvalidConfigException("Form class '{$formClass}' must exist and extend from '{$activeForm}'."); } $this->validateDisplay(); } if ($this->bootstrap) { Html::addCssClass($this->options, 'table'); if ($this->hover) { Html::addCssClass($this->options, 'table-hover'); } if ($this->bordered) { Html::addCssClass($this->options, 'table-bordered'); } if ($this->condensed) { Html::addCssClass($this->options, 'table-condensed'); } $this->_childTableOptions = $this->options; if ($this->striped) { Html::addCssClass($this->options, 'table-striped'); } } Html::addCssClass($this->_childTableOptions, 'kv-child-table'); Html::addCssClass($this->options, 'detail-view'); Html::addCssStyle($this->labelColOptions, "text-align:{$this->hAlign};vertical-align:{$this->vAlign};"); parent::init(); if (empty($this->container['id'])) { $this->container['id'] = $this->getId(); } $this->initI18N(__DIR__); if ($this->enableEditMode) { $this->formOptions['fieldConfig']['template'] = "{input}\n{hint}\n{error}"; $this->_form = $formClass::begin($this->formOptions); } Html::addCssClass($this->alertContainerOptions, 'panel-body kv-alert-container'); $this->alertMessageSettings += ['kv-detail-error' => 'alert alert-danger', 'kv-detail-success' => 'alert alert-success', 'kv-detail-info' => 'alert alert-info', 'kv-detail-warning' => 'alert alert-warning']; $this->registerAssets(); }