本文整理汇总了PHP中kartik\base\Config::isValidInput方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::isValidInput方法的具体用法?PHP Config::isValidInput怎么用?PHP Config::isValidInput使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kartik\base\Config
的用法示例。
在下文中一共展示了Config::isValidInput方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
/**
* Initializes the widget
*
* @throws InvalidConfigException
*/
public function init()
{
$this->_msgCat = 'kveditable';
parent::init();
if (empty($this->inputType)) {
throw new InvalidConfigException("The 'type' of editable input must be set.");
}
if (!Config::isValidInput($this->inputType)) {
throw new InvalidConfigException("Invalid input type '{$this->inputType}'.");
}
if ($this->inputType === self::INPUT_WIDGET && empty($this->widgetClass)) {
throw new InvalidConfigException("The 'widgetClass' must be set when the 'inputType' is set to 'widget'.");
}
if (Config::isDropdownInput($this->inputType) && !isset($this->data)) {
throw new InvalidConfigException("You must set the 'data' property for '{$this->inputType}'.");
}
if (!empty($this->formClass) && !class_exists($this->formClass)) {
throw new InvalidConfigException("The form class '{$this->formClass}' does not exist.");
}
Config::validateInputWidget($this->inputType);
$this->initI18N(__DIR__);
$this->initOptions();
$this->_popoverOptions['options']['id'] = $this->options['id'] . '-popover';
$this->_popoverOptions['toggleButton']['id'] = $this->options['id'] . '-targ';
$this->registerAssets();
echo Html::beginTag('div', $this->containerOptions);
if ($this->format == self::FORMAT_BUTTON) {
echo Html::tag('div', $this->displayValue, $this->editableValueOptions);
}
if ($this->asPopover === true) {
PopoverX::begin($this->_popoverOptions);
} elseif ($this->format !== self::FORMAT_BUTTON) {
echo $this->renderToggleButton();
}
echo Html::beginTag('div', $this->contentOptions);
$class = $this->formClass;
$this->_form = $class::begin($this->formOptions);
if (!$this->_form instanceof \yii\widgets\ActiveForm) {
throw new InvalidConfigException("The form class '{$class}' MUST extend from \\yii\\widgets\\ActiveForm.");
}
}