本文整理汇总了PHP中yii\widgets\ActiveForm::classname方法的典型用法代码示例。如果您正苦于以下问题:PHP ActiveForm::classname方法的具体用法?PHP ActiveForm::classname怎么用?PHP ActiveForm::classname使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\widgets\ActiveForm
的用法示例。
在下文中一共展示了ActiveForm::classname方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initWidget
/**
* 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};");
}
示例2: init
/**
* @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();
}