1717trait GlobalAttributesTrait
1818{
1919
20- /**
21- * Indicates whether the element can be edited in place
22- */
23- protected ?ContentEditableEnum $ contenteditable = null ;
24-
2520 /**
2621 * Represents the spellchecking behavior of the element
2722 */
@@ -33,72 +28,8 @@ trait GlobalAttributesTrait
3328 */
3429 private ?InputModeEnum $ inputmode = null ;
3530
36- public function setId (string $ id ): static
37- {
38- $ this ->id = $ id ;
39- return $ this ;
40- }
41-
42- public function getId (): ?string
43- {
44- return $ this ->id ;
45- }
46-
47- /**
48- * @description Assigns CSS class names to an element.
49- */
50- public function setClass (string $ className ): static
51- {
52- $ this ->className = $ className ;
53- return $ this ;
54- }
5531
56- public function getClass (): ?string
57- {
58- return $ this ->className ;
59- }
6032
61- /**
62- * alias
63- */
64- public function getClassName (): ?string
65- {
66- return $ this ->className ;
67- }
68-
69- /**
70- * alias
71- */
72- public function setClassName (string $ className ): static
73- {
74- return $ this ->setClass ($ className );
75- }
76-
77- /**
78- * @description Defines whether the content is editable by the user.
79- */
80- public function setContentEditable (
81- bool |string |ContentEditableEnum $ contentEditable = ContentEditableEnum::TRUE
82- ): static {
83- if (is_string ($ contentEditable ) && ! in_array (
84- $ contentEditable ,
85- array_map (fn ($ e ) => $ e ->value , ContentEditableEnum::cases ())
86- )) {
87- throw new InvalidArgumentException ('Invalid value for contenteditable ' );
88- }
89- $ contentEditable = is_bool (
90- $ contentEditable
91- ) ? ($ contentEditable === true ? 'true ' : 'false ' ) : $ contentEditable ;
92- $ contentEditable = is_string ($ contentEditable ) ? ContentEditableEnum::from ($ contentEditable ) : $ contentEditable ;
93- $ this ->contenteditable = $ contentEditable ;
94- $ this ->delegated ->setAttribute (ContentEditableEnum::getQualifiedName (), $ contentEditable ->value );
95- return $ this ;
96- }
97-
98- public function getContentEditable (): ?ContentEditableEnum
99- {
100- return $ this ->contenteditable ;
101- }
10233
10334 /**
10435 * @description Suggests an input mode (e.g., numeric, email, tel).
0 commit comments