本文整理汇总了PHP中kartik\helpers\Html::addCssStyle方法的典型用法代码示例。如果您正苦于以下问题:PHP Html::addCssStyle方法的具体用法?PHP Html::addCssStyle怎么用?PHP Html::addCssStyle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kartik\helpers\Html
的用法示例。
在下文中一共展示了Html::addCssStyle方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validateDisplay
/**
* Validates the display of correct attributes and buttons
* at initialization based on mode
*
* @return void
*/
protected function validateDisplay()
{
$none = 'display:none';
if (count($this->model->getErrors()) > 0) {
$this->mode = self::MODE_EDIT;
}
if ($this->mode === self::MODE_EDIT) {
Html::addCssClass($this->container, 'kv-edit-mode');
Html::addCssStyle($this->viewAttributeContainer, $none);
Html::addCssStyle($this->viewButtonsContainer, $none);
} else {
Html::addCssClass($this->container, 'kv-view-mode');
Html::addCssStyle($this->editAttributeContainer, $none);
Html::addCssStyle($this->editButtonsContainer, $none);
}
}
示例2: renderFormAttribute
/**
* Renders each form attribute
*
* @param array $config the attribute config
*
* @return mixed
* @throws \yii\base\InvalidConfigException
*/
protected function renderFormAttribute($config)
{
if (empty($config['attribute'])) {
return '';
}
$model = ArrayHelper::getValue($config, 'editModel', $this->model);
if (!$model instanceof Model) {
$model = $this->model;
}
$attr = ArrayHelper::getValue($config, 'updateAttr', $config['attribute']);
$input = ArrayHelper::getValue($config, 'type', self::INPUT_TEXT);
$fieldConfig = ArrayHelper::getValue($config, 'fieldConfig', []);
$inputWidth = ArrayHelper::getValue($config, 'inputWidth', '');
$container = ArrayHelper::getValue($config, 'inputContainer', []);
if ($inputWidth != '') {
Html::addCssStyle($container, "width: {$inputWidth}");
// deprecated since v1.7.4
}
$template = ArrayHelper::getValue($fieldConfig, 'template', "{input}\n{error}\n{hint}");
$row = Html::tag('div', $template, $container);
if (static::hasGridCol($container)) {
$row = '<div class="row">' . $row . '</div>';
}
$fieldConfig['template'] = $row;
if (substr($input, 0, 8) == "\\kartik\\") {
Config::validateInputWidget($input, 'as an input widget for DetailView edit mode');
} elseif ($input !== self::INPUT_WIDGET && !in_array($input, self::$_inputsList)) {
throw new InvalidConfigException("Invalid input type '{$input}' defined for the attribute '" . $config['attribute'] . "'.");
}
$options = ArrayHelper::getValue($config, 'options', []);
$widgetOptions = ArrayHelper::getValue($config, 'widgetOptions', []);
$class = ArrayHelper::remove($widgetOptions, 'class', '');
if (!empty($config['options'])) {
$widgetOptions['options'] = $config['options'];
}
if (Config::isInputWidget($input)) {
$class = $input;
return $this->_form->field($model, $attr, $fieldConfig)->widget($class, $widgetOptions);
}
if ($input === self::INPUT_WIDGET) {
if ($class == '') {
throw new InvalidConfigException("Widget class not defined in 'widgetOptions' for {$input}'.");
}
return $this->_form->field($model, $attr, $fieldConfig)->widget($class, $widgetOptions);
}
if (in_array($input, self::$_dropDownInputs)) {
$items = ArrayHelper::getValue($config, 'items', []);
return $this->_form->field($model, $attr, $fieldConfig)->{$input}($items, $options);
}
if ($input == self::INPUT_HTML5_INPUT) {
$inputType = ArrayHelper::getValue($config, 'inputType', self::INPUT_TEXT);
return $this->_form->field($model, $attr, $fieldConfig)->{$input}($inputType, $options);
}
return $this->_form->field($model, $attr, $fieldConfig)->{$input}($options);
}
示例3: validateDisplay
/**
* Validates the display of correct attributes and buttons
* at initialization based on mode
*/
protected function validateDisplay()
{
$none = 'display:none';
if ($this->mode === self::MODE_VIEW) {
Html::addCssStyle($this->editAttributeContainer, $none);
Html::addCssStyle($this->editButtonsContainer, $none);
} else {
Html::addCssStyle($this->viewAttributeContainer, $none);
Html::addCssStyle($this->viewButtonsContainer, $none);
}
}