Hidden
The input element with a type attribute whose value is hidden
represents a value not intended to be examined or
manipulated by the user.
Instantiate the Hidden
class using Hidden::widget()
.
$Hidden = Hidden::widget();
Use the provided methods to set specific attributes for the a element.
// setting class attribute
$Hidden->class('container');
Or, use the attributes
method to set multiple attributes at once.
$Hidden->attributes(['class' => 'container', 'style' => 'background-color: #eee;']);
Generate the HTML
output using the render
method, for simple instantiation.
$html = $Hidden->render();
Or, use the magic __toString
method.
$html = (string) $Hidden;
Below are examples of common use cases:
// adding multiple attributes
$Hidden->class('external')->value('Myvalue');
Explore additional methods for setting various attributes such as id
, name
, style
, value
, etc.
Refer to the Attribute Tests for comprehensive examples.
The following methods are available for setting attributes:
Method | Description |
---|---|
attributes() |
Set multiple attributes at once. |
class() |
Set the class attribute. |
id() |
Set the id attribute. |
name() |
Set the name attribute. |
style() |
Set the style attribute. |
value() |
Set the value attribute. |
Refer to the Custom Methods Tests for comprehensive examples.
The following methods are available for customizing the HTML
output:
Method | Description |
---|---|
render() |
Generates the HTML output. |
widget() |
Instantiates the Hidden::class . |