$p = \Jyxo\HtmlTag::create('p')->setClass('buttons');
The magic __call() method ensures attributes settings.
$p->render();
The render() method creates the HTML output.
ファイルを表示
Open project: jyxo/php
Method | Description | |
---|---|---|
__call ( string $method, array $args ) : mixed | Sets or returns the attribute. | |
__get ( string $name ) : mixed | Returns an attribute value. | |
__toString ( ) : string | Renders the HTML element. | |
addChild ( |
Adds a child element. | |
addChildren ( array $elements ) : self | Adds multiple child elements. | |
close ( ) : string | Creates and returns the closing tag. | |
content ( ) : string | Creates and returns element's contents. | |
create ( string $tag ) : self | Creates an element instance. | |
createFromSource ( string $html ) : self | Returns an element instance from the given source. | |
open ( ) : string | Creates and returns the opening tag. | |
render ( ) : string | Renders the element. | |
setAttributes ( array $attributes ) : self | Imports attributes from the given array. | |
setContentOnly ( boolean $contentOnly ) : selfs | Sets if only the contents should be rendered. | |
setNoEncode ( string $attribute ) : self | Sets an attribute to not be espaced on output. |
Method | Description | |
---|---|---|
__construct ( string $tag ) | Constructor. | |
isRequiredAttr ( string $tag, string $attr ) : boolean | Returns if the given attribute is mandatory. |
public addChild ( |
||
$element | Child element to be added | |
return | self |
public addChildren ( array $elements ) : self | ||
$elements | array | Array of child elements |
return | self |
public static createFromSource ( string $html ) : self | ||
$html | string | HTML source code |
return | self |
public setAttributes ( array $attributes ) : self | ||
$attributes | array | Associative array of attributes and their values |
return | self |
public setContentOnly ( boolean $contentOnly ) : selfs | ||
$contentOnly | boolean | Should only the contents be rendered |
return | selfs |
public setNoEncode ( string $attribute ) : self | ||
$attribute | string | Attribute name |
return | self |