/** * 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; }
<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('
/** * 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; }
/** * 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(); }