Trait Yiisoft\Form\Field\Base\Placeholder\PlaceholderTrait
Public Methods
| Method | Description | Defined By |
|---|---|---|
| placeholder() | Yiisoft\Form\Field\Base\Placeholder\PlaceholderTrait | |
| usePlaceholder() | Yiisoft\Form\Field\Base\Placeholder\PlaceholderTrait |
Protected Methods
| Method | Description | Defined By |
|---|---|---|
| getInputData() | Yiisoft\Form\Field\Base\Placeholder\PlaceholderTrait | |
| preparePlaceholderInInputAttributes() | Yiisoft\Form\Field\Base\Placeholder\PlaceholderTrait |
Method Details
| protected abstract Yiisoft\Form\Field\Base\InputData\InputDataInterface getInputData ( ) |
abstract protected function getInputData(): InputDataInterface;
| public self placeholder ( string|null $placeholder ) | ||
| $placeholder | string|null | |
public function placeholder(?string $placeholder): self
{
$new = clone $this;
$new->placeholder = $placeholder;
return $new;
}
| protected void preparePlaceholderInInputAttributes ( array &$attributes ) | ||
| $attributes | array | |
protected function preparePlaceholderInInputAttributes(array &$attributes): void
{
if (
$this->usePlaceholder
&& !isset($attributes['placeholder'])
) {
$placeholder = $this->placeholder ?? $this->getInputData()->getPlaceholder();
if ($placeholder !== null) {
$attributes['placeholder'] = $placeholder;
}
}
}
| public self usePlaceholder ( boolean $use ) | ||
| $use | boolean | |
public function usePlaceholder(bool $use): self
{
$new = clone $this;
$new->usePlaceholder = $use;
return $new;
}
Signup or Login in order to comment.