Renders the hint tag.
public hint ( string | boolean $content, array $options = [] ) | ||
$content | string | boolean | 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]]. |
$options | array | 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()]]. |
/** * @inheritdoc */ public function hint($content, $options = []) { if ($this->getConfigParam('showHints') === false) { $this->parts['{hint}'] = ''; return $this; } if ($this->_isHintSpecial) { Html::addCssClass($options, 'kv-hint-block'); } return parent::hint($this->generateHint($content), $options); }
/** * @inheritdoc */ public function hint($content, $options = []) { if ($this->getConfigParam('showHints') === false) { $this->parts['{hint}'] = ''; return $this; } return parent::hint($this->generateHint($content), $options); }
/** * * Стандартная обработка поля формы. * * @param \yii\widgets\ActiveField $field * @return \yii\widgets\ActiveField */ public function postFieldRender(\yii\widgets\ActiveField $field) { if ($this->property->hint) { $field->hint((string) $this->property->hint); } if ($this->property->name) { $field->label($this->property->name); } else { $field->label(false); } return $field; }
public function testHint() { $expectedValue = '<div class="hint-block">Hint Content</div>'; $this->activeField->hint('Hint Content'); $this->assertEquals($expectedValue, $this->activeField->parts['{hint}']); }
/** * Alias of hint * @see \yii\widgets\ActiveField::hint($content, $options); */ public function note($content, $options = array()) { return parent::hint($content, $options); }