本文整理匯總了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();
}