generated from yii-tools/template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
HasAlt.php
29 lines (25 loc) · 752 Bytes
/
HasAlt.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
<?php
declare(strict_types=1);
namespace UIAwesome\Html\Attribute;
/**
* Is used by widgets that implement the alt method.
*/
trait HasAlt
{
/**
* Set the alt attribute, provide the alternative text valid for the image button or img only, displaying the value
* of the attribute if the image src is missing or otherwise fails to load.
*
* @param string $value The alternative text.
*
* @return static A new instance of the current class with the specified alt value.
*
* @link https://html.spec.whatwg.org/multipage/input.html#attr-input-alt
*/
public function alt(string $value): static
{
$new = clone $this;
$new->attributes['alt'] = $value;
return $new;
}
}