InlineScript
class InlineScript extends AbstractComponent implements Script
Implementation of a script tag having script code as its content
IMPORTANT:
This component contains scripting statements
Methods
Constructor
Returns the attribute container attached to the component
Identifies the element with an unique id attribute.
Sets an attribute name value pair
Removes given attribute if it is not locked
Returns the value of a given attribute name or an empty string if attribute is not set
Adds the specified CSS class names
Removes given CSS class names
Determines whether the given CSS class names are stored into the manager
Returns the content of the component as a string
No description
Returns the hash value
Details
at line 38
__construct(string|null $code = null)
Constructor
in
AbstractTag at line 45
__destruct()
Destructor
in
AbstractTag at line 57
__clone()
Clones the object
Note: Method cannot be called directly!
in
AbstractTag at line 64
string
getTagName()
Returns the tag name of the component
in
AbstractTag at line 69
AttributeContainer
attributes()
Returns the attribute container attached to the component
in
AbstractTag at line 77
string
identify(string|null $id = null)
Identifies the element with an unique id attribute.
Notes:
HTML id attribute is unique to every HTML-element. Therefore given id is checked for its uniqueness.
in
AbstractTag at line 82
ClassAttribute
cssClasses()
Returns the class attribute object
in
AbstractTag at line 87
Component
css(array|string|null $styles = null)
Sets the inline styles
in
AbstractTag at line 93
StyleAttribute
style()
Returns the attribute object containing inline styles
in
AbstractTag at line 98
Component
setAttribute(string $name, mixed $value = true)
Sets an attribute name value pair
IMPORTANT!: Does not alter locked attribute values:
- For 'class' attribute: if a CSS class name is locked the method does nothing
- For any other locked attribute the method throws a UnmodifiableAttributeException
$value
parameter:
- the type of the value should always convert to string
null
or an emptystring
: an empty attribute is set- boolean
true
: an empty attribute is set - boolean
false
: attribute is removed - otherwise the attribute value is the string conversion value
in
AbstractTag at line 104
Component
removeAttribute(string $name)
Removes given attribute if it is not locked
in
AbstractTag at line 110
mixed
getAttribute(string $name)
Returns the value of a given attribute name or an empty string if attribute is not set
in
AbstractTag at line 115
bool
attributeExists(string $name)
Checks if an attribute exists
in
AbstractTag at line 120
CssClassifiableContent
addCssClass(string ...$cssClasses)
Adds the specified CSS class names
Important: a single $cssClasses argument can contain multiple comma separated CSS class names.
in
AbstractTag at line 126
CssClassifiableContent
removeCssClass(string ...$cssClasses)
Removes given CSS class names
Important: a single $cssClasses argument can contain multiple comma separated CSS class names.
in
AbstractTag at line 132
bool
hasCssClass(string ...$cssClasses)
Determines whether the given CSS class names are stored into the manager
Important: a single $cssClasses argument can contain multiple comma separated CSS class names.
in
AbstractComponent at line 29
string
getOpeningTag()
Returns opening tag with its attributes
at line 58
string
contentToString()
Returns the content of the component as a string
in
AbstractComponent at line 51
string
getClosingTag()
Returns closing tag
in
AbstractComponent at line 56
string
__toString()
Gets a string representation of the object
at line 47
InlineScript
appendJavaScript(string $code)
No description
at line 53
string
getHash()
Returns the hash value