Debian Codegraph @

vendor/ipl/html/src/FormElement/TextElement.php

raw
1 <?php
2
3 namespace ipl\Html\FormElement;
4
5 use ipl\Html\Attributes;
6
7 class TextElement extends InputElement
8 {
9 protected $type = 'text';
10
11 /** @var ?string Placeholder text for the input */
12 protected ?string $placeholder = null;
13
14 /**
15 * Get the placeholder
16 *
17 * @return ?string
18 */
19 public function getPlaceholder(): ?string
20 {
21 return $this->placeholder;
22 }
23
24 /**
25 * Set the placeholder
26 *
27 * @param ?string $placeholder
28 *
29 * @return $this
30 */
31 public function setPlaceholder(?string $placeholder): self
32 {
33 $this->placeholder = $placeholder;
34
35 return $this;
36 }
37
38 protected function registerAttributeCallbacks(Attributes $attributes): void
39 {
40 parent::registerAttributeCallbacks($attributes);
41
42 $attributes->registerAttributeCallback('placeholder', [$this, 'getPlaceholder'], [$this, 'setPlaceholder']);
43 }
44 }