本文整理汇总了PHP中yii\helpers\Html::activeHint方法的典型用法代码示例。如果您正苦于以下问题:PHP Html::activeHint方法的具体用法?PHP Html::activeHint怎么用?PHP Html::activeHint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\helpers\Html
的用法示例。
在下文中一共展示了Html::activeHint方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: hint
/**
* Renders the hint tag.
* @param string|bool $content the hint content.
* If `null`, the hint will be generated via [[Model::getAttributeHint()]].
* If `false`, the generated field will not contain the hint part.
* Note that this will NOT be [[Html::encode()|encoded]].
* @param array $options the tag options in terms of name-value pairs. These will be rendered as
* the attributes of the hint tag. The values will be HTML-encoded using [[Html::encode()]].
*
* The following options are specially handled:
*
* - `tag`: this specifies the tag name. If not set, `div` will be used.
* See also [[\yii\helpers\Html::tag()]].
*
* @return $this the field object itself.
*/
public function hint($content, $options = [])
{
if ($content === false) {
$this->parts['{hint}'] = '';
return $this;
}
$options = array_merge($this->hintOptions, $options);
if ($content !== null) {
$options['hint'] = $content;
}
$this->parts['{hint}'] = Html::activeHint($this->model, $this->attribute, $options);
return $this;
}
示例2:
<div class="input-group" >
<span class="input-group-btn"><?php
echo $buttonDropdown;
?>
</span>
<?php
echo MaskedInput::widget($widgetConfig);
?>
</div>
<?php
if ($widget->hint) {
?>
<?php
echo Html::activeHint($widget->model, $widget->attribute, ['hint' => $widget->hint]);
?>
<?php
}
?>
<?php
}
?>
</div>
</div>
<?php
$this->registerCss('
示例3: hint
/**
* Renders the hint tag.
* @param string $content the hint content. It will NOT be HTML-encoded.
* @param array $options the tag options in terms of name-value pairs. These will be rendered as
* the attributes of the hint tag. The values will be HTML-encoded using [[Html::encode()]].
*
* The following options are specially handled:
*
* - tag: this specifies the tag name. If not set, "div" will be used.
*
* @return $this the field object itself
*/
public function hint($content, $options = [])
{
$options = array_merge($this->hintOptions, $options);
$options['hint'] = $content;
$this->parts['{hint}'] = Html::activeHint($this->model, $this->attribute, $options);
return $this;
}
示例4: render
/**
* Renders the whole field.
* This method will generate the label, error tag, input tag and hint tag (if any), and
* assemble them into HTML according to [[template]].
* @param string|callable $content the content within the field container.
* If null (not set), the default methods will be called to generate the label, error tag and input tag,
* and use them as the content.
* If a callable, it will be called to generate the content. The signature of the callable should be:
*
* ~~~
* function ($field) {
* return $html;
* }
* ~~~
*
* @return string the rendering result
*/
public function render($content = null)
{
if ($content === null) {
if (!isset($this->parts['{input}'])) {
$this->parts['{input}'] = Html::activeTextInput($this->model, $this->attribute, $this->inputOptions);
}
if (!isset($this->parts['{label}'])) {
$this->parts['{label}'] = Html::activeLabel($this->model, $this->attribute, $this->labelOptions);
}
if (!isset($this->parts['{error}'])) {
$this->parts['{error}'] = Html::error($this->model, $this->attribute, $this->errorOptions);
}
if (!isset($this->parts['{hint}'])) {
$this->parts['{hint}'] = Html::activeHint($this->model, $this->attribute, $this->hintOptions);
}
$content = strtr($this->template, $this->parts);
} elseif (!is_string($content)) {
$content = call_user_func($content, $this);
}
return $this->begin() . "\n" . $content . "\n" . $this->end();
}