yii\widgets\ActiveField::hint PHP Méthode

hint() public méthode

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()]].
    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;
    }

Usage Example

 /**
  * @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);
 }
All Usage Examples Of yii\widgets\ActiveField::hint