generated from yii-tools/template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHasPlaceholder.php
34 lines (30 loc) · 1.01 KB
/
HasPlaceholder.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
declare(strict_types=1);
namespace UIAwesome\Html\Attribute\FormControl;
/**
* Is used by widgets that implement the placeholder method.
*/
trait HasPlaceholder
{
/**
* Set the placeholder attribute valid for text, search, url, tel, email, password, and number, provides a brief
* hint to the user as to what kind of information is expected in the field.
*
* It should be a word or short phrase that provides a hint as to the expected type of data, rather than an
* explanation or prompt.
*
* The text must not include carriage returns or line feeds.
*
* @param string $value The placeholder text.
*
* @return static A new instance of the current class with the specified placeholder text.
*
* @link https://html.spec.whatwg.org/multipage/input.html#the-placeholder-attribute
*/
public function placeholder(string $value): static
{
$new = clone $this;
$new->attributes['placeholder'] = $value;
return $new;
}
}