0 follower

Trait Yiisoft\Form\Field\Base\Placeholder\PlaceholderTrait

Implemented byYiisoft\Form\Field\Email, Yiisoft\Form\Field\Number, Yiisoft\Form\Field\Password, Yiisoft\Form\Field\Telephone, Yiisoft\Form\Field\Text, Yiisoft\Form\Field\Textarea, Yiisoft\Form\Field\Url

Method Details

Hide inherited methods

getInputData() protected abstract method

protected abstract Yiisoft\Form\Field\Base\InputData\InputDataInterface getInputData ( )

                abstract protected function getInputData(): InputDataInterface;

            
placeholder() public method

public self placeholder ( string|null $placeholder )
$placeholder string|null

                public function placeholder(?string $placeholder): self
{
    $new = clone $this;
    $new->placeholder = $placeholder;
    return $new;
}

            
preparePlaceholderInInputAttributes() protected method

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;
        }
    }
}

            
usePlaceholder() public method

public self usePlaceholder ( boolean $use )
$use boolean

                public function usePlaceholder(bool $use): self
{
    $new = clone $this;
    $new->usePlaceholder = $use;
    return $new;
}