Phalcon html
NOTE
All classes are prefixed with Phalcon
Html\Attributes¶
Class Source on GitHub
This class helps to work with HTML Attributes
Phalcon\Support\CollectionPhalcon\Html\Attributes— implementsPhalcon\Html\Attributes\RenderInterface
Uses Phalcon\Html\Attributes\RenderInterface · Phalcon\Html\Escaper\AttributeEscaper · Phalcon\Html\Exceptions\AttributeNotRenderable · Phalcon\Support\Collection
Method Summary¶
public string __toString() Alias of the render method public string render() Render attributes as HTML attributes protected string renderAttributes( array $attributes ) @todo remove this when we refactor forms. Maybe remove this class? Put it into traits Methods¶
__toString()¶
Alias of the render method
render()¶
Render attributes as HTML attributes
renderAttributes()¶
@todo remove this when we refactor forms. Maybe remove this class? Put it into traits
Html\Attributes\AttributesInterface¶
Interface Source on GitHub
Html Attributes Interface
Phalcon\Html\Attributes\AttributesInterface
Uses Phalcon\Html\Attributes
Method Summary¶
public Attributes getAttributes() Get Attributes public AttributesInterface setAttributes( Attributes $attributes ) Set Attributes Methods¶
getAttributes()¶
Get Attributes
setAttributes()¶
Set Attributes
Html\Attributes\RenderInterface¶
Interface Source on GitHub
Rendering interface for HTML attributes
Phalcon\Html\Attributes\RenderInterface
Method Summary¶
Methods¶
render()¶
Generate a string representation
Html\Breadcrumbs¶
Class Source on GitHub
Phalcon\Html\Breadcrumbs
This component offers an easy way to create breadcrumbs for your application. The resulting HTML when calling render() will have each breadcrumb enclosed in <dt> tags, while the whole string is enclosed in <dl> tags.
Phalcon\Html\Breadcrumbs
Method Summary¶
public static add(string $label,string $link = "") Adds a new crumb. public void clear() Clears the crumbs public string getSeparator() Crumb separator public void remove( string $link ) Removes crumb by url. public string render() Renders and outputs breadcrumbs based on previously set template. public static setSeparator( string $separator ) public array toArray() Returns the internal breadcrumbs array Methods¶
add()¶
Adds a new crumb.
// Adding a crumb with a link
$breadcrumbs->add("Home", "/");
// Adding a crumb without a link (normally the last one)
$breadcrumbs->add("Users");
Crumbs are stored keyed by their link, so adding two crumbs that share the same link - including two link-less crumbs, which share the empty string key - keeps only the last one.
clear()¶
Clears the crumbs
getSeparator()¶
Crumb separator
remove()¶
Removes crumb by url.
$breadcrumbs->remove("/admin/user/create");
// remove a crumb without an url (last link)
$breadcrumbs->remove();
render()¶
Renders and outputs breadcrumbs based on previously set template.
setSeparator()¶
toArray()¶
Returns the internal breadcrumbs array
Html\Escaper¶
Class Source on GitHub
Phalcon\Html\Escaper
Escapes different kinds of text securing them. By using this component you may prevent XSS attacks.
The class is a façade over five per-context escapers (HtmlEscaper, AttributeEscaper, CssEscaper, JsEscaper, UrlEscaper). Each can be retrieved via the matching getXxxEscaper() accessor and substituted via the matching setXxxEscaper() setter. The legacy setEncoding, setFlags, and setDoubleEncode continue to fan out to all sub-objects so existing code keeps working.
This component only works with UTF-8. The PREG extension needs to be compiled with UTF-8 support.
$escaper = new \Phalcon\Html\Escaper();
$escaped = $escaper->css("font-family: <Verdana>");
echo $escaped; // font\2D family\3A \20 \3C Verdana\3E
@property AttributeEscaper $attributeEscaper @property CssEscaper $cssEscaper @property HtmlEscaper $htmlEscaper @property JsEscaper $jsEscaper @property UrlEscaper $urlEscaper
Phalcon\Html\Escaper— implementsPhalcon\Html\Escaper\EscaperInterface
Uses Phalcon\Html\Escaper\AttributeEscaper · Phalcon\Html\Escaper\CssEscaper · Phalcon\Html\Escaper\EscaperInterface · Phalcon\Html\Escaper\HtmlEscaper · Phalcon\Html\Escaper\JsEscaper · Phalcon\Html\Escaper\UrlEscaper
Method Summary¶
public __construct(string $encoding = "utf-8",int $flags = 11,bool $doubleEncode = true) public string attributes( mixed $input = null ) Escapes a HTML attribute string or array. Delegates to the configured public string css( string $input ) Escape CSS strings. Delegates to the configured CssEscaper. public string|null detectEncoding( string $input ) public string escapeCss( string $input ) public string escapeHtml( string $input = null ) public string escapeHtmlAttr( string $input = null ) public string escapeJs( string $input ) public string escapeUrl( string $input ) public AttributeEscaper getAttributeEscaper() public CssEscaper getCssEscaper() public string getEncoding() public int getFlags() public HtmlEscaper getHtmlEscaper() public JsEscaper getJsEscaper() public UrlEscaper getUrlEscaper() public string html( string $input = null ) Escapes a HTML string. Delegates to the configured HtmlEscaper. public string js( string $input ) Escape javascript strings. Delegates to the configured JsEscaper. public string normalizeEncoding( string $input ) public static setAttributeEscaper( AttributeEscaper $escaper ) public static setCssEscaper( CssEscaper $escaper ) public static setDoubleEncode( bool $doubleEncode ) Sets the double_encode flag. Fans out to all sub-objects. public static setEncoding( string $encoding ) Sets the encoding. Fans out to all sub-objects. public static setFlags( int $flags ) Sets the htmlspecialchars flags. Fans out to all sub-objects. public static setHtmlEscaper( HtmlEscaper $escaper ) public static setHtmlQuoteType( int $flags ) public static setJsEscaper( JsEscaper $escaper ) public static setUrlEscaper( UrlEscaper $escaper ) public string url( string $input ) Escapes a URL. Delegates to the configured UrlEscaper. Properties¶
protected AttributeEscaper $attributeEscaper protected CssEscaper $cssEscaper protected HtmlEscaper $htmlEscaper protected JsEscaper $jsEscaper protected UrlEscaper $urlEscaper Methods¶
__construct()¶
public function __construct(
string $encoding = "utf-8",
int $flags = 11,
bool $doubleEncode = true
);
attributes()¶
Escapes a HTML attribute string or array. Delegates to the configured AttributeEscaper.
css()¶
Escape CSS strings. Delegates to the configured CssEscaper.
detectEncoding()¶
escapeCss()¶
escapeHtml()¶
escapeHtmlAttr()¶
escapeJs()¶
escapeUrl()¶
getAttributeEscaper()¶
getCssEscaper()¶
getEncoding()¶
getFlags()¶
getHtmlEscaper()¶
getJsEscaper()¶
getUrlEscaper()¶
html()¶
Escapes a HTML string. Delegates to the configured HtmlEscaper.
js()¶
Escape javascript strings. Delegates to the configured JsEscaper.
normalizeEncoding()¶
setAttributeEscaper()¶
setCssEscaper()¶
setDoubleEncode()¶
Sets the double_encode flag. Fans out to all sub-objects.
setEncoding()¶
Sets the encoding. Fans out to all sub-objects.
setFlags()¶
Sets the htmlspecialchars flags. Fans out to all sub-objects.
setHtmlEscaper()¶
setHtmlQuoteType()¶
setJsEscaper()¶
setUrlEscaper()¶
url()¶
Escapes a URL. Delegates to the configured UrlEscaper.
Html\EscaperFactory¶
Class Source on GitHub
Class EscaperFactory
Phalcon\Html\EscaperFactory
Method Summary¶
Methods¶
newInstance()¶
Create a new instance of the object
Html\Escaper\AbstractEscaper¶
Abstract Source on GitHub
Shared base for the per-context escaper objects. Holds the encoding, htmlspecialchars flag, and double-encode toggle, plus the encoding detection / normalization utilities used by the CSS and JS escapers.
Each concrete context (HtmlEscaper, AttributeEscaper, CssEscaper, JsEscaper, UrlEscaper) extends this so that callers can configure one context without affecting the others.
@property bool $doubleEncode @property string $encoding @property int $flags
Phalcon\Html\Escaper\AbstractEscaper
Method Summary¶
public string|null detectEncoding( string $input ) Detects the character encoding of a string. Special-handling for public bool getDoubleEncode() public string getEncoding() public int getFlags() public string normalizeEncoding( string $input ) Normalizes a string's encoding to UTF-32, used by the CSS and JS public static setDoubleEncode( bool $doubleEncode ) public static setEncoding( string $encoding ) public static setFlags( int $flags ) Properties¶
protected bool $doubleEncode = true protected string $encoding = "utf-8" protected int $flags = 11 ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401 Methods¶
detectEncoding()¶
Detects the character encoding of a string. Special-handling for chr(172) and chr(128) to chr(159) which fail to be detected by mb_detect_encoding().
getDoubleEncode()¶
getEncoding()¶
getFlags()¶
normalizeEncoding()¶
Normalizes a string's encoding to UTF-32, used by the CSS and JS escapers before invoking the C-level escape routines.
setDoubleEncode()¶
setEncoding()¶
setFlags()¶
Html\Escaper\AttributeEscaper¶
Class Source on GitHub
Escapes either a single attribute value (string) or an associative array of attribute pairs. Boolean true becomes a bare key (e.g. disabled); false and null skip the entry; arrays are joined with a space.
Phalcon\Html\Escaper\AbstractEscaperPhalcon\Html\Escaper\AttributeEscaper
Method Summary¶
public string __invoke( mixed $input = null ) public string escape( mixed $input = null ) protected string escapeValue( string $input ) Encodes a single key/value via htmlspecialchars. Methods¶
__invoke()¶
escape()¶
escapeValue()¶
Encodes a single key/value via htmlspecialchars.
Html\Escaper\CssEscaper¶
Class Source on GitHub
Escapes a string for use inside a CSS value by replacing non-alphanumeric characters with their hexadecimal escape sequence.
Phalcon\Html\Escaper\AbstractEscaperPhalcon\Html\Escaper\CssEscaper
Method Summary¶
Methods¶
__invoke()¶
escape()¶
Html\Escaper\EscaperInterface¶
Interface Source on GitHub
Interface for Phalcon\Html\Escaper.
This declares the stable context-escaping surface. The concrete {@see \Phalcon\Html\Escaper} facade also exposes members that are not part of this contract - setDoubleEncode(), getFlags(), and the per-context sub-escaper getters/setters (getHtmlEscaper(), setAttributeEscaper(), and the rest). Type against the concrete class to reach those.
Phalcon\Html\Escaper\EscaperInterface
Method Summary¶
public string attributes( string $input ) Escapes a HTML attribute string. public string css( string $input ) Escape CSS strings by replacing non-alphanumeric chars by their public string getEncoding() Returns the internal encoding used by the escaper public string html( string $input ) Escapes a HTML string. public string js( string $input ) Escape Javascript strings by replacing non-alphanumeric chars by their public EscaperInterface setEncoding( string $encoding ) Sets the encoding to be used by the escaper public EscaperInterface setFlags( int $flags ) Sets the HTML quoting type for htmlspecialchars public string url( string $input ) Escapes a URL. Internally uses rawurlencode Methods¶
attributes()¶
Escapes a HTML attribute string.
The concrete {@see \Phalcon\Html\Escaper} also accepts an array of attribute pairs and tolerates null: an array is rendered as escaped key="value" pairs, null and false values are skipped, and true renders as a bare key. Callers typed against this interface pass a string. The widened signature lands in the next major.
css()¶
Escape CSS strings by replacing non-alphanumeric chars by their hexadecimal representation
getEncoding()¶
Returns the internal encoding used by the escaper
html()¶
Escapes a HTML string.
The concrete {@see \Phalcon\Html\Escaper} tolerates null, returning an empty string for it. The nullable signature lands in the next major.
js()¶
Escape Javascript strings by replacing non-alphanumeric chars by their hexadecimal representation
setEncoding()¶
Sets the encoding to be used by the escaper
setFlags()¶
Sets the HTML quoting type for htmlspecialchars
url()¶
Escapes a URL. Internally uses rawurlencode
Html\Escaper\Exception¶
Class Source on GitHub
Class Exception
\ExceptionPhalcon\Html\Escaper\Exception
Html\Escaper\HtmlEscaper¶
Class Source on GitHub
Escapes a string for use as HTML body content via htmlspecialchars.
Phalcon\Html\Escaper\AbstractEscaperPhalcon\Html\Escaper\HtmlEscaper
Method Summary¶
Methods¶
__invoke()¶
escape()¶
Html\Escaper\JsEscaper¶
Class Source on GitHub
Escapes a string for use inside a JavaScript context by replacing non-alphanumeric characters with their hexadecimal escape sequence.
Phalcon\Html\Escaper\AbstractEscaperPhalcon\Html\Escaper\JsEscaper
Method Summary¶
Methods¶
__invoke()¶
escape()¶
Html\Escaper\UrlEscaper¶
Class Source on GitHub
Escapes a string for use as a URL component via rawurlencode.
Phalcon\Html\Escaper\AbstractEscaperPhalcon\Html\Escaper\UrlEscaper
Method Summary¶
Methods¶
__invoke()¶
escape()¶
Html\Exception¶
Class Source on GitHub
Phalcon\Html\Exception
Exceptions thrown in Phalcon\Html will use this class
\Exception
Html\Exceptions\AttributeNotRenderable¶
Class Source on GitHub
\ExceptionPhalcon\Html\ExceptionPhalcon\Html\Exceptions\AttributeNotRenderable
Uses Phalcon\Html\Exception
Method Summary¶
Methods¶
__construct()¶
Html\Exceptions\FriendlyTitleConversionFailed¶
Class Source on GitHub
\ExceptionPhalcon\Html\ExceptionPhalcon\Html\Exceptions\FriendlyTitleConversionFailed
Uses Phalcon\Html\Exception
Method Summary¶
Methods¶
__construct()¶
Html\Exceptions\InvalidResultsetValue¶
Class Source on GitHub
InvalidArgumentExceptionPhalcon\Html\Exceptions\InvalidResultsetValue
Uses InvalidArgumentException
Method Summary¶
Methods¶
__construct()¶
Html\Exceptions\ServiceNotRegistered¶
Class Source on GitHub
\ExceptionPhalcon\Html\ExceptionPhalcon\Html\Exceptions\ServiceNotRegistered
Uses Phalcon\Html\Exception
Method Summary¶
Methods¶
__construct()¶
Html\Exceptions\UsingRequiresTwoValues¶
Class Source on GitHub
InvalidArgumentExceptionPhalcon\Html\Exceptions\UsingRequiresTwoValues
Uses InvalidArgumentException
Method Summary¶
Methods¶
__construct()¶
Html\Helper\AbstractHelper¶
Abstract Source on GitHub
@property string $delimiter @property EscaperInterface $escaper @property string $indent @property int $indentLevel
Phalcon\Html\Helper\AbstractHelperPhalcon\Html\Helper\AbstractListPhalcon\Html\Helper\AbstractSeriesPhalcon\Html\Helper\AnchorPhalcon\Html\Helper\BasePhalcon\Html\Helper\BodyPhalcon\Html\Helper\BreadcrumbsPhalcon\Html\Helper\ButtonPhalcon\Html\Helper\ClosePhalcon\Html\Helper\ElementPhalcon\Html\Helper\FormPhalcon\Html\Helper\FriendlyTitlePhalcon\Html\Helper\ImgPhalcon\Html\Helper\Input\AbstractGroupPhalcon\Html\Helper\Input\AbstractInputPhalcon\Html\Helper\LabelPhalcon\Html\Helper\PreloadPhalcon\Html\Helper\TagPhalcon\Html\Helper\TitlePhalcon\Html\Helper\VoidTag
Uses Phalcon\Html\Escaper\EscaperInterface · Phalcon\Html\Exception
Method Summary¶
public __construct(EscaperInterface $escaper,Doctype $doctype = null) AbstractHelper constructor. protected string close(string $tag,bool $raw = false) Produces a closing tag protected string indent() Replicates the indent x times as per indentLevel protected array injectAttribute(string $key,string $value,array $attributes) Forces a single key into the attribute array, stripping any user-supplied protected array orderAttributes(array $overrides,array $attributes) Keeps all the attributes sorted - same order all the time protected string renderArrayElements(array $elements,string $delimiter) Traverses an array and calls the method defined in the first element protected string renderAttributes( array $attributes ) Renders all the attributes protected string renderElement(string $tag,array $attributes = []) Renders an element protected string renderFullElement(string $tag,string $text,array $attributes = [],bool $raw = false) Renders an element protected string renderTag(string $tag,array $attributes = [],string $close = "") Renders a tag protected string selfClose(string $tag,array $attributes = []) Produces a self close tag i.e. <img /> Properties¶
protected string $delimiter = "" protected Doctype|null $doctype = null protected EscaperInterface $escaper protected string $indent = " " protected int $indentLevel = 1 Methods¶
__construct()¶
AbstractHelper constructor.
close()¶
Produces a closing tag
indent()¶
Replicates the indent x times as per indentLevel
injectAttribute()¶
Forces a single key into the attribute array, stripping any user-supplied value for that key first. Used by helpers whose first positional argument is itself an attribute (href for Anchor, src for Img, etc.) to make sure that argument always wins.
orderAttributes()¶
Keeps all the attributes sorted - same order all the time
renderArrayElements()¶
Traverses an array and calls the method defined in the first element with attributes as the second, returning the resulting string
renderAttributes()¶
Renders all the attributes
renderElement()¶
Renders an element
renderFullElement()¶
protected function renderFullElement(
string $tag,
string $text,
array $attributes = [],
bool $raw = false
): string;
Renders an element
renderTag()¶
Renders a tag
selfClose()¶
Produces a self close tag i.e.
Html\Helper\AbstractList¶
Abstract Source on GitHub
Class AbstractList
Phalcon\Html\Helper\AbstractHelperPhalcon\Html\Helper\AbstractList
Uses Phalcon\Html\Exception
Method Summary¶
public static __invoke(string $indent = " ",string $delimiter = null,array $attributes = []) public __toString() Generates and returns the HTML for the list. protected string getTag() Returns the tag name. Properties¶
protected array $attributes = [] protected string $elementTag = "li" protected array $store = [] Methods¶
__invoke()¶
public function __invoke(
string $indent = " ",
string $delimiter = null,
array $attributes = []
): static;
__toString()¶
Generates and returns the HTML for the list.
getTag()¶
Returns the tag name.
Html\Helper\AbstractSeries¶
Abstract Source on GitHub
@property array $attributes @property array $store
Phalcon\Html\Helper\AbstractHelperPhalcon\Html\Helper\AbstractSeries
Method Summary¶
public static __invoke(string $indent = " ",string $delimiter = null) public __toString() Generates and returns the HTML for the list. Entries are sorted by public static reset() Resets the internal store. protected string getTag() Returns the tag name. protected void pushOrPlace(array $entry,int $position = -1) Appends an entry to the store, optionally at a specific integer Properties¶
protected array $attributes = [] protected array $store = [] Methods¶
__invoke()¶
__toString()¶
Generates and returns the HTML for the list. Entries are sorted by their integer key first, so an asset registered with a lower position renders before one registered with a higher position regardless of registration order.
reset()¶
Resets the internal store.
getTag()¶
Returns the tag name.
pushOrPlace()¶
Appends an entry to the store, optionally at a specific integer position. When position is negative the entry is pushed onto the next available auto-increment slot. When position is non-negative the entry is placed at that key, advancing past any already-occupied slots so existing entries are not overwritten. The store is ksort()ed in __toString, so positions act as a sort key, not a strict address.
Html\Helper\Anchor¶
Class Source on GitHub
Class Anchor
@property bool $forceRaw
Phalcon\Html\Helper\AbstractHelperPhalcon\Html\Helper\Anchor
Uses Phalcon\Html\Escaper\EscaperInterface · Phalcon\Html\Exception
Method Summary¶
public __construct(EscaperInterface $escaper,Doctype $doctype = null,bool $forceRaw = false) public string __invoke(string $href,string $text,array $attributes = [],bool $raw = false) Produce a <a> tag Properties¶
protected bool $forceRaw = false Methods¶
__construct()¶
public function __construct(
EscaperInterface $escaper,
Doctype $doctype = null,
bool $forceRaw = false
);
__invoke()¶
public function __invoke(
string $href,
string $text,
array $attributes = [],
bool $raw = false
): string;
Produce a tag
Html\Helper\Base¶
Class Source on GitHub
Class Base
Phalcon\Html\Helper\AbstractHelperPhalcon\Html\Helper\Base
Uses Phalcon\Html\Exception
Method Summary¶
Methods¶
__invoke()¶
Produce a <base/> tag.
Html\Helper\Body¶
Class Source on GitHub
Class Body
Phalcon\Html\Helper\AbstractHelperPhalcon\Html\Helper\Body
Uses Phalcon\Html\Exception
Method Summary¶
Methods¶
__invoke()¶
Produce a <body> tag.
Html\Helper\Breadcrumbs¶
Class Source on GitHub
This component offers an easy way to create breadcrumbs for your application. The resulting HTML when calling render() will have each breadcrumb enclosed in <li> tags, while the whole string is enclosed in <nav> and <ol> tags.
Phalcon\Html\Helper\AbstractHelperPhalcon\Html\Helper\Breadcrumbs
Uses Phalcon\Html\Escaper\EscaperInterface · Phalcon\Mvc\Url\UrlInterface · Phalcon\Support\Helper\Str\Interpolate
Method Summary¶
public __construct(EscaperInterface $escaper,UrlInterface $url = null) AbstractHelper constructor. public static __invoke(string $indent = " ",string $delimiter = null) Sets the indent and delimiter and returns the object back. public static add(string $text,string $link = "",string $icon = "",array $attributes = []) Adds a new crumb. public void clear() Clears the crumbs. public static clearAttributes() Clear the attributes of the parent element. public array getAttributes() Get the attributes of the parent element. public string getPrefix() Returns the link prefix. public string getSeparator() Returns the separator. public array getTemplate() Return the current template. public void remove( int $index ) Removes crumb by url. public string render() Renders and outputs breadcrumbs based on previously set template. public static setAttributes( array $attributes ) Set the attributes for the parent element. public static setPrefix( string $prefix ) Set the link prefix prepended to every non-empty link during rendering. public static setSeparator( string $separator ) Set the separator. public static setTemplate(string $main,string $line,string $last) Set the HTML template. public array toArray() Returns the internal breadcrumbs array. Methods¶
__construct()¶
AbstractHelper constructor.
__invoke()¶
Sets the indent and delimiter and returns the object back.
add()¶
public function add(
string $text,
string $link = "",
string $icon = "",
array $attributes = []
): static;
Adds a new crumb.
// Adding a crumb with a link
$breadcrumbs->add("Home", "/");
// Adding a crumb with added attributes
$breadcrumbs->add("Home", "/", ["class" => "main"]);
// Adding a crumb without a link (normally the last one)
$breadcrumbs->add("Users");
clear()¶
Clears the crumbs.
clearAttributes()¶
Clear the attributes of the parent element.
getAttributes()¶
Get the attributes of the parent element.
getPrefix()¶
Returns the link prefix.
getSeparator()¶
Returns the separator.
getTemplate()¶
Return the current template.
remove()¶
Removes crumb by url.
render()¶
Renders and outputs breadcrumbs based on previously set template.
setAttributes()¶
Set the attributes for the parent element.
setPrefix()¶
Set the link prefix prepended to every non-empty link during rendering. When a Url service was injected, calling this method replaces it.
setSeparator()¶
Set the separator.
setTemplate()¶
Set the HTML template.
toArray()¶
Returns the internal breadcrumbs array.
Html\Helper\Button¶
Class Source on GitHub
Class Button
@property bool $forceRaw
Phalcon\Html\Helper\AbstractHelperPhalcon\Html\Helper\Button
Uses Phalcon\Html\Escaper\EscaperInterface · Phalcon\Html\Exception
Method Summary¶
public __construct(EscaperInterface $escaper,Doctype $doctype = null,bool $forceRaw = false) public string __invoke(string $text,array $attributes = [],bool $raw = false) Produce a <button> tag. Properties¶
protected bool $forceRaw = false Methods¶
__construct()¶
public function __construct(
EscaperInterface $escaper,
Doctype $doctype = null,
bool $forceRaw = false
);
__invoke()¶
Produce a <button> tag.
Html\Helper\Close¶
Class Source on GitHub
Class Close
Phalcon\Html\Helper\AbstractHelperPhalcon\Html\Helper\Close
Method Summary¶
Methods¶
__invoke()¶
Produce a </...> tag.
Html\Helper\Doctype¶
Class Source on GitHub
Creates Doctype tags
Phalcon\Html\Helper\Doctype
Method Summary¶
public __construct() public static __invoke(int $type = self::HTML5,string $delimiter = "\n") Produce a <doctype> tag public string __toString() public int getType() Constants¶
int HTML32 = 1 int HTML401_FRAMESET = 4 int HTML401_STRICT = 2 int HTML401_TRANSITIONAL = 3 int HTML5 = 5 int XHTML10_FRAMESET = 8 int XHTML10_STRICT = 6 int XHTML10_TRANSITIONAL = 7 int XHTML11 = 9 int XHTML20 = 10 int XHTML5 = 11 Methods¶
__construct()¶
__invoke()¶
Produce a
__toString()¶
getType()¶
Html\Helper\Element¶
Class Source on GitHub
Class Element
@property bool $forceRaw
Phalcon\Html\Helper\AbstractHelperPhalcon\Html\Helper\Element
Uses Phalcon\Html\Escaper\EscaperInterface · Phalcon\Html\Exception
Method Summary¶
public __construct(EscaperInterface $escaper,Doctype $doctype = null,bool $forceRaw = false) public string __invoke(string $tag,string $text,array $attributes = [],bool $raw = false) Produce a tag. Properties¶
protected bool $forceRaw = false Methods¶
__construct()¶
public function __construct(
EscaperInterface $escaper,
Doctype $doctype = null,
bool $forceRaw = false
);
__invoke()¶
public function __invoke(
string $tag,
string $text,
array $attributes = [],
bool $raw = false
): string;
Produce a tag.
Html\Helper\Form¶
Class Source on GitHub
Class Form
Phalcon\Html\Helper\AbstractHelperPhalcon\Html\Helper\Form
Uses Phalcon\Html\Exception
Method Summary¶
Methods¶
__invoke()¶
Produce a <form> tag.
Html\Helper\FriendlyTitle¶
Class Source on GitHub
Converts text to a URL-friendly slug.
Phalcon\Html\Helper\AbstractHelperPhalcon\Html\Helper\FriendlyTitle
Uses Phalcon\Html\Escaper\EscaperInterface · Phalcon\Html\Exception · Phalcon\Html\Exceptions\FriendlyTitleConversionFailed · Phalcon\Support\Helper\Str\Friendly
Method Summary¶
public __construct( EscaperInterface $escaper ) public string __invoke(string $text,string $separator = "-",bool $lowercase = true,mixed $replace = null) Properties¶
protected Friendly $friendly Methods¶
__construct()¶
__invoke()¶
public function __invoke(
string $text,
string $separator = "-",
bool $lowercase = true,
mixed $replace = null
): string;
Html\Helper\Img¶
Class Source on GitHub
Class Img
Phalcon\Html\Helper\AbstractHelperPhalcon\Html\Helper\Img
Uses Phalcon\Html\Exception
Method Summary¶
Methods¶
__invoke()¶
Produce a tag.
Html\Helper\Input\AbstractChecked¶
Abstract Source on GitHub
Shared base for inputs that can be checked: <input type="checkbox"> and <input type="radio">. Holds the optional surrounding <label> markup, the unchecked companion hidden input, and the rule that decides whether the rendered tag carries checked="checked".
The match between checked and value is loose (==) by default so that mixed int/string form input round-trips correctly (e.g. value=0 against checked="0"). Strict (===) matching is available via strict(true).
@property array $label @property bool $strict
Phalcon\Html\Helper\AbstractHelperPhalcon\Html\Helper\Input\AbstractInputPhalcon\Html\Helper\Input\AbstractChecked
Uses Phalcon\Html\Escaper\EscaperInterface · Phalcon\Html\Helper\Doctype
Method Summary¶
public __construct(EscaperInterface $escaper,Doctype $doctype = null) public __toString() Returns the HTML for the input, optionally surrounded by the label public static label( array $attributes = [] ) Attaches a wrapping <label> to the element. The supplied attributes public static strict( bool $flag = true ) Toggles strict (===) comparison between the checked attribute and protected void processChecked() Decides whether the rendered tag carries checked="checked". Two protected string processUnchecked() Returns the markup for the optional hidden companion input that lets Properties¶
protected array $label = [] protected bool $strict = false Methods¶
__construct()¶
__toString()¶
Returns the HTML for the input, optionally surrounded by the label fragment configured via label() and preceded by the hidden companion input emitted when an unchecked attribute is supplied.
label()¶
Attaches a wrapping <label> to the element. The supplied attributes are merged with a default for pointing at the input's id. A text pseudo-attribute, if present, becomes the label text and is stripped from the rendered attributes.
strict()¶
Toggles strict (===) comparison between the checked attribute and the value attribute when deciding whether to render the input as checked. Defaults to loose (==), which matches typical form-input round-tripping where types may differ between the source data and the value rendered into the markup.
processChecked()¶
Decides whether the rendered tag carries checked="checked". Two paths qualify as checked: an unconditional opt-in via ["checked" => "checked"] (case-insensitive) or ["checked" => true], and a value-match path where the supplied checked attribute equals the input's value (== by default, === under strict(true)).
processUnchecked()¶
Returns the markup for the optional hidden companion input that lets a checkbox/radio submit a value when unchecked.
Html\Helper\Input\AbstractGroup¶
Abstract Source on GitHub
Shared base for rendering a group of same-named inputs (checkbox or radio) from an options array.
Each option in the $options array may be either: - a scalar string label: ['value' => 'Label text'] - a rich definition: ['value' => ['label' => 'Label text', 'disabled' => true, ...]]
The $checked parameter is resolved by the concrete subclass: - CheckboxGroup compares against an array of selected values - RadioGroup compares against a single scalar value
Phalcon\Html\Helper\AbstractHelperPhalcon\Html\Helper\Input\AbstractGroup
Uses Phalcon\Html\Helper\AbstractHelper
Method Summary¶
public static __invoke(string $name,array $options,mixed $checked = null,array $attributes = []) public string __toString() Renders the group of inputs as a string. protected bool isChecked( string $value ) Determines whether the given value is considered checked. protected string renderItem(string $value,mixed $definition) Renders a single input + optional label pair. Properties¶
protected mixed $checked = null protected string $name = "" protected array $options = [] protected array $sharedAttributes = [] protected string $type = "checkbox" Methods¶
__invoke()¶
public function __invoke(
string $name,
array $options,
mixed $checked = null,
array $attributes = []
): static;
__toString()¶
Renders the group of inputs as a string.
isChecked()¶
Determines whether the given value is considered checked.
renderItem()¶
Renders a single input + optional label pair.
Html\Helper\Input\AbstractInput¶
Abstract Source on GitHub
Class AbstractInput
@property array $attributes @property string $type @property string $value
Phalcon\Html\Helper\AbstractHelperPhalcon\Html\Helper\Input\AbstractInput
Uses Phalcon\Html\Helper\AbstractHelper · Phalcon\Html\Helper\Doctype
Method Summary¶
public static __invoke(string $name,string $value = null,array $attributes = []) public __toString() Returns the HTML for the input. public static setValue( string $value = null ) Sets the value of the element Properties¶
protected array $attributes = [] protected string $type = "text" Methods¶
__invoke()¶
__toString()¶
Returns the HTML for the input.
setValue()¶
Sets the value of the element
Html\Helper\Input\Checkbox¶
Class Source on GitHub
Renders an <input type="checkbox">. Behavior (label wrapping, unchecked companion, loose-by-default checked match) lives in AbstractChecked.
Phalcon\Html\Helper\AbstractHelperPhalcon\Html\Helper\Input\AbstractInputPhalcon\Html\Helper\Input\AbstractCheckedPhalcon\Html\Helper\Input\Checkbox
Properties¶
protected string $type = "checkbox" Html\Helper\Input\CheckboxGroup¶
Class Source on GitHub
Renders a group of <input type="checkbox"> elements from an options array.
The $checked parameter should be an array of selected values, or a single scalar value (treated as a one-element array).
Phalcon\Html\Helper\AbstractHelperPhalcon\Html\Helper\Input\AbstractGroupPhalcon\Html\Helper\Input\CheckboxGroup
Method Summary¶
Properties¶
protected string $type = "checkbox" Methods¶
isChecked()¶
Returns true when $value appears in the checked list.
Html\Helper\Input\Generic¶
Class Source on GitHub
Generic input helper. The HTML5 type attribute is supplied via the constructor, which means the TagFactory can register a single class for all type-string-only inputs (color, date, email, hidden, number, ...) and differentiate them through the recipe map. The type can also be changed after construction via setType().
Phalcon\Html\Helper\AbstractHelperPhalcon\Html\Helper\Input\AbstractInputPhalcon\Html\Helper\Input\Generic
Uses Phalcon\Html\Escaper\EscaperInterface · Phalcon\Html\Helper\Doctype
Method Summary¶
public __construct(EscaperInterface $escaper,Doctype $doctype = null,string $type = "text") public AbstractInput setType( string $type ) Sets the type of the input. Methods¶
__construct()¶
public function __construct(
EscaperInterface $escaper,
Doctype $doctype = null,
string $type = "text"
);
setType()¶
Sets the type of the input.
Html\Helper\Input\Radio¶
Class Source on GitHub
Renders an <input type="radio">. Behavior (label wrapping, unchecked companion, loose-by-default checked match) lives in AbstractChecked.
Phalcon\Html\Helper\AbstractHelperPhalcon\Html\Helper\Input\AbstractInputPhalcon\Html\Helper\Input\AbstractCheckedPhalcon\Html\Helper\Input\Radio
Properties¶
protected string $type = "radio" Html\Helper\Input\RadioGroup¶
Class Source on GitHub
Renders a group of <input type="radio"> elements from an options array.
The $checked parameter should be a single scalar value matching the selected option's value attribute.
Phalcon\Html\Helper\AbstractHelperPhalcon\Html\Helper\Input\AbstractGroupPhalcon\Html\Helper\Input\RadioGroup
Method Summary¶
Properties¶
protected string $type = "radio" Methods¶
isChecked()¶
Returns true when $value loosely equals the checked scalar.
Html\Helper\Input\Select¶
Class Source on GitHub
Class Select
Phalcon\Html\Helper\AbstractHelperPhalcon\Html\Helper\AbstractListPhalcon\Html\Helper\Input\Select
Uses Phalcon\Contracts\Html\Helper\Input\SelectData · Phalcon\Html\Helper\AbstractList
Method Summary¶
public static add(string $text,string $value = null,array $attributes = [],bool $raw = false) Add an element to the list public static addPlaceholder(string $text,string $value = null,array $attributes = [],bool $raw = false) Add a placeholder to the element public static fromData( SelectData $data ) Populates the select from a data provider. public static optGroup(string $label = null,array $attributes = []) Creates an option group public static placeholder( string $text ) Adds a non-selectable placeholder option as the first entry. Renders public static selected( string $selected ) public static strict( bool $flag = true ) Toggles strict (===) comparison between an option's value and protected string getTag() protected string optGroupEnd() protected string optGroupStart(string $label,array $attributes) Properties¶
protected string $elementTag = "option" protected bool $inOptGroup = false protected string $selected = "" protected bool $strict = false Methods¶
add()¶
public function add(
string $text,
string $value = null,
array $attributes = [],
bool $raw = false
): static;
Add an element to the list
addPlaceholder()¶
public function addPlaceholder(
string $text,
string $value = null,
array $attributes = [],
bool $raw = false
): static;
Add a placeholder to the element
fromData()¶
Populates the select from a data provider.
Flat entries: key = option value, value = label string. Optgroup entries: key = group label, value = [value => label] array.
optGroup()¶
Creates an option group
placeholder()¶
Adds a non-selectable placeholder option as the first entry. Renders as <option value="" disabled selected>$text</option>, matching the common HTML idiom for "Choose..."-style prompts.
selected()¶
strict()¶
Toggles strict (===) comparison between an option's value and the previously stored selected value. Defaults to loose (==), matching the round-tripping fix in AbstractChecked so mixed int/string form data marks the right option as selected.
getTag()¶
optGroupEnd()¶
optGroupStart()¶
Html\Helper\Input\Select\ArrayData¶
Class Source on GitHub
Wraps a plain PHP array as a SELECT data provider.
Keys are option values; string values are labels; array values define optgroups.
Phalcon\Html\Helper\Input\Select\ArrayData— implementsPhalcon\Contracts\Html\Helper\Input\SelectData
Uses Phalcon\Contracts\Html\Helper\Input\SelectData
Method Summary¶
public __construct(array $data = [],array $attributes = []) public array getAttributes() public array getOptions() Properties¶
protected array $attributes = [] protected array $data = [] Methods¶
__construct()¶
getAttributes()¶
getOptions()¶
Html\Helper\Input\Select\ResultsetData¶
Class Source on GitHub
Phalcon\Html\Helper\Input\Select\ResultsetData— implementsPhalcon\Contracts\Html\Helper\Input\SelectData
Uses InvalidArgumentException · Phalcon\Contracts\Html\Helper\Input\SelectData · Phalcon\Html\Exceptions\InvalidResultsetValue · Phalcon\Html\Exceptions\UsingRequiresTwoValues · Phalcon\Mvc\Model\ResultsetInterface
Method Summary¶
public __construct(ResultsetInterface $resultset,array $using,array $attributesMap = []) public array getAttributes() Returns per-option attribute maps, keyed by option value. public array getOptions() protected readField(mixed $option,string $field) Reads a property from the row, supporting both objects (via protected void resolve() Walks the resultset once, building both the option map and the Properties¶
protected array $attributesMap = [] protected array|null $resolvedAttributes = null protected array|null $resolvedOptions = null protected ResultsetInterface $resultset protected array $using = [] Methods¶
__construct()¶
public function __construct(
ResultsetInterface $resultset,
array $using,
array $attributesMap = []
);
getAttributes()¶
Returns per-option attribute maps, keyed by option value.
getOptions()¶
readField()¶
Reads a property from the row, supporting both objects (via readAttribute when present) and plain arrays.
resolve()¶
Walks the resultset once, building both the option map and the per-option resolved attribute map. Closures in attributesMap receive the current row; static values are passed through. false or null values skip the attribute entirely.
Html\Helper\Input\Textarea¶
Class Source on GitHub
Class Textarea
Phalcon\Html\Helper\AbstractHelperPhalcon\Html\Helper\Input\AbstractInputPhalcon\Html\Helper\Input\Textarea
Uses Phalcon\Html\Exception
Method Summary¶
Properties¶
protected string $type = "textarea" Methods¶
__toString()¶
Returns the HTML for the input.
Html\Helper\Label¶
Class Source on GitHub
Class Label
@property bool $forceRaw
Phalcon\Html\Helper\AbstractHelperPhalcon\Html\Helper\Label
Uses Phalcon\Html\Escaper\EscaperInterface · Phalcon\Html\Exception
Method Summary¶
public __construct(EscaperInterface $escaper,Doctype $doctype = null,bool $forceRaw = false) public string __invoke(string $label,array $attributes = [],bool $raw = false) Produce a <label> tag. Properties¶
protected bool $forceRaw = false Methods¶
__construct()¶
public function __construct(
EscaperInterface $escaper,
Doctype $doctype = null,
bool $forceRaw = false
);
__invoke()¶
Produce a <label> tag.
Html\Helper\Link¶
Class Source on GitHub
Creates tags
Phalcon\Html\Helper\AbstractHelperPhalcon\Html\Helper\AbstractSeriesPhalcon\Html\Helper\StylePhalcon\Html\Helper\Link
Method Summary¶
public static add(string $url,array $attributes = [],int $position = -1) Add an element to the list protected array getAttributes(string $url,array $attributes) Returns the necessary attributes protected string getTag() Methods¶
add()¶
Add an element to the list
getAttributes()¶
Returns the necessary attributes
getTag()¶
Html\Helper\Meta¶
Class Source on GitHub
Class Meta
Phalcon\Html\Helper\AbstractHelperPhalcon\Html\Helper\AbstractSeriesPhalcon\Html\Helper\Meta
Uses Phalcon\Html\Exception
Method Summary¶
public static add(array $attributes = [],int $position = -1) Add an element to the list public static addHttp(string $httpEquiv,string $content,int $position = -1) public static addName(string $name,string $content,int $position = -1) public static addProperty(string $name,string $content,int $position = -1) protected string getTag() Methods¶
add()¶
Add an element to the list
addHttp()¶
addName()¶
addProperty()¶
getTag()¶
Html\Helper\Ol¶
Class Source on GitHub
Class Ol
@property bool $forceRaw
Phalcon\Html\Helper\AbstractHelperPhalcon\Html\Helper\AbstractListPhalcon\Html\Helper\Ol
Uses Phalcon\Html\Escaper\EscaperInterface
Method Summary¶
public __construct(EscaperInterface $escaper,Doctype $doctype = null,bool $forceRaw = false) public static add(string $text,array $attributes = [],bool $raw = false) Add an element to the list protected string getTag() Properties¶
protected bool $forceRaw = false Methods¶
__construct()¶
public function __construct(
EscaperInterface $escaper,
Doctype $doctype = null,
bool $forceRaw = false
);
add()¶
Add an element to the list
getTag()¶
Html\Helper\Preload¶
Class Source on GitHub
Generates a tag for resource hinting. If a ResponseInterface is provided, also sets the HTTP Link header.
Phalcon\Html\Helper\AbstractHelperPhalcon\Html\Helper\Preload
Uses Phalcon\Html\Escaper\EscaperInterface · Phalcon\Html\Link\Link · Phalcon\Html\Link\Serializer\Header · Phalcon\Http\ResponseInterface
Method Summary¶
public __construct(EscaperInterface $escaper,ResponseInterface $response = null) public string __invoke(string $href,string $type = "style",array $attributes = []) Properties¶
protected ResponseInterface|null $response = null Methods¶
__construct()¶
__invoke()¶
Html\Helper\Script¶
Class Source on GitHub
Class Script
Phalcon\Html\Helper\AbstractHelperPhalcon\Html\Helper\AbstractSeriesPhalcon\Html\Helper\Script
Uses Phalcon\Html\Exception
Method Summary¶
public static add(string $url,array $attributes = [],int $position = -1) Add an element to the list public void beginInternal() Begins capturing inline script content via output buffering. Pair public static endInternal(array $attributes = [],int $position = -1) Closes an inline-script buffer opened by beginInternal() and adds protected array getAttributes(string $url,array $attributes) Returns the necessary attributes protected string getTag() Methods¶
add()¶
Add an element to the list
beginInternal()¶
Begins capturing inline script content via output buffering. Pair with endInternal() to close the buffer and append the captured markup as a <script>...</script> block in the asset stack.
endInternal()¶
Closes an inline-script buffer opened by beginInternal() and adds the captured content as a <script>...</script> entry. Any attributes supplied are placed on the wrapping tag. The script body is treated as raw HTML (it is JavaScript, not user-supplied text).
getAttributes()¶
Returns the necessary attributes
getTag()¶
Html\Helper\Style¶
Class Source on GitHub
Class Style
Phalcon\Html\Helper\AbstractHelperPhalcon\Html\Helper\AbstractSeriesPhalcon\Html\Helper\Style
Uses Phalcon\Html\Exception
Method Summary¶
public static add(string $url,array $attributes = [],int $position = -1) Add an element to the list public static setStyle( bool $flag ) Sets if this is a style or link tag protected array getAttributes(string $url,array $attributes) Returns the necessary attributes protected string getTag() Methods¶
add()¶
Add an element to the list
setStyle()¶
Sets if this is a style or link tag
getAttributes()¶
Returns the necessary attributes
getTag()¶
Html\Helper\Tag¶
Class Source on GitHub
Generic open-tag escape hatch. Renders just <name attr="..."> for any tag name without a dedicated helper. For an open + content + close tag use Element instead. For self-closing void tags (img, br, hr, etc.) use VoidTag.
Phalcon\Html\Helper\AbstractHelperPhalcon\Html\Helper\Tag
Uses Phalcon\Html\Exception
Method Summary¶
Methods¶
__invoke()¶
Html\Helper\Title¶
Class Source on GitHub
Class Title
@property array $append @property string $delimiter @property string $indent @property array $prepend @property string $title @property string $separator
Phalcon\Html\Helper\AbstractHelperPhalcon\Html\Helper\Title
Uses Phalcon\Html\Exception
Method Summary¶
public static __invoke(string $indent = " ",string $delimiter = null) Sets the separator and returns the object back public __toString() Returns the title tags public static append(string $text,bool $raw = false) Appends text to current document title public string get() Returns the title public static prepend(string $text,bool $raw = false) Prepends text to current document title public static set(string $text,bool $raw = false) Sets the title public static setSeparator(string $separator,bool $raw = false) Sets the separator Properties¶
protected array $append = [] protected array $prepend = [] protected string $separator = "" protected string $title = "" Methods¶
__invoke()¶
Sets the separator and returns the object back
__toString()¶
Returns the title tags
append()¶
Appends text to current document title
get()¶
Returns the title
prepend()¶
Prepends text to current document title
set()¶
Sets the title
setSeparator()¶
Sets the separator
Html\Helper\Ul¶
Class Source on GitHub
Class Ul
Phalcon\Html\Helper\AbstractHelperPhalcon\Html\Helper\AbstractListPhalcon\Html\Helper\OlPhalcon\Html\Helper\Ul
Method Summary¶
Methods¶
getTag()¶
Html\Helper\VoidTag¶
Class Source on GitHub
Generic void-tag escape hatch. Renders a self-closing tag for any name without a dedicated helper. The trailing / is emitted only for XHTML doctypes, matching the Input/AbstractInput::__toString convention.
Phalcon\Html\Helper\AbstractHelperPhalcon\Html\Helper\VoidTag
Uses Phalcon\Html\Exception
Method Summary¶
Methods¶
__invoke()¶
Html\Link\AbstractLink¶
Abstract Source on GitHub
@property Collection $attributes @property string $href @property Collection $rels @property bool $templated
Phalcon\Html\Link\AbstractLink
Uses Phalcon\Support\Collection
Method Summary¶
public __construct(string $rel = "",string $href = "",array $attributes = []) Link constructor. protected array doGetAttributes() Returns a list of attributes that describe the target URI. protected string doGetHref() Returns the target of the link. protected array doGetRels() Returns the relationship type(s) of the link. protected bool doIsTemplated() Returns whether this is a templated link. protected static doWithAttribute(string $key,mixed $value) protected static doWithHref( string $href ) protected static doWithRel( string $key ) protected static doWithoutAttribute( string $key ) protected static doWithoutRel( string $key ) protected bool hrefIsTemplated( string $href ) Determines if a href is a templated link or not. Properties¶
protected Collection $attributes protected string $href = "" protected Collection $rels protected bool $templated = false Methods¶
__construct()¶
Link constructor.
doGetAttributes()¶
Returns a list of attributes that describe the target URI.
doGetHref()¶
Returns the target of the link.
The target link must be one of: - An absolute URI, as defined by RFC 5988. - A relative URI, as defined by RFC 5988. The base of the relative link is assumed to be known based on context by the client. - A URI template as defined by RFC 6570.
If a URI template is returned, isTemplated() MUST return True.
doGetRels()¶
Returns the relationship type(s) of the link.
This method returns 0 or more relationship types for a link, expressed as an array of strings.
doIsTemplated()¶
Returns whether this is a templated link.
doWithAttribute()¶
doWithHref()¶
doWithRel()¶
doWithoutAttribute()¶
doWithoutRel()¶
hrefIsTemplated()¶
Determines if a href is a templated link or not.
@see https://tools.ietf.org/html/rfc6570
Html\Link\AbstractLinkProvider¶
Abstract Source on GitHub
@property array $links
Phalcon\Html\Link\AbstractLinkProvider
Uses Phalcon\Html\Link\Interfaces\LinkInterface
Method Summary¶
public __construct( array $links = [] ) LinkProvider constructor. protected array doGetLinks() Returns an iterable of LinkInterface objects. protected array doGetLinksByRel( string $rel ) Returns an iterable of LinkInterface objects that have a specific protected static doWithLink( mixed $link ) Returns an instance with the specified link included. protected static doWithoutLink( mixed $link ) Returns an instance with the specified link removed. protected string getKey( mixed $link ) Returns the object hash key Properties¶
protected array $links = [] Methods¶
__construct()¶
LinkProvider constructor.
doGetLinks()¶
Returns an iterable of LinkInterface objects.
The iterable may be an array or any PHP \Traversable object. If no links are available, an empty array or \Traversable MUST be returned.
doGetLinksByRel()¶
Returns an iterable of LinkInterface objects that have a specific relationship.
The iterable may be an array or any PHP \Traversable object. If no links with that relationship are available, an empty array or \Traversable MUST be returned.
doWithLink()¶
Returns an instance with the specified link included.
If the specified link is already present, this method MUST return normally without errors. The link is present if $link is === identical to a link object already in the collection.
doWithoutLink()¶
Returns an instance with the specified link removed.
If the specified link is not present, this method MUST return normally without errors. The link is present if $link is === identical to a link object already in the collection.
getKey()¶
Returns the object hash key
Html\Link\EvolvableLink¶
Class Source on GitHub
Class Phalcon\Html\Link\EvolvableLink
Phalcon\Html\Link\AbstractLinkPhalcon\Html\Link\LinkPhalcon\Html\Link\EvolvableLink— implementsPhalcon\Html\Link\Interfaces\EvolvableLinkInterface
Uses Phalcon\Html\Link\Interfaces\EvolvableLinkInterface
Method Summary¶
public static withAttribute(mixed $attribute,mixed $value) Returns an instance with the specified attribute added. public static withHref( string $href ) Returns an instance with the specified href. public static withRel( string $rel ) Returns an instance with the specified relationship included. public static withoutAttribute( string $attribute ) Returns an instance with the specified attribute excluded. public static withoutRel( string $rel ) Returns an instance with the specified relationship excluded. Methods¶
withAttribute()¶
Returns an instance with the specified attribute added.
If the specified attribute is already present, it will be overwritten with the new value.
withHref()¶
Returns an instance with the specified href.
An implementing library SHOULD evaluate a passed object to a string immediately rather than waiting for it to be returned later.
withRel()¶
Returns an instance with the specified relationship included.
If the specified rel is already present, this method MUST return normally without errors, but without adding the rel a second time.
withoutAttribute()¶
Returns an instance with the specified attribute excluded.
If the specified attribute is not present, this method MUST return normally without errors.
withoutRel()¶
Returns an instance with the specified relationship excluded.
If the specified rel is not present, this method MUST return normally without errors.
Html\Link\EvolvableLinkProvider¶
Class Source on GitHub
Class Phalcon\Html\Link\EvolvableLinkProvider
@property LinkInterface[] $links
Phalcon\Html\Link\AbstractLinkProviderPhalcon\Html\Link\LinkProviderPhalcon\Html\Link\EvolvableLinkProvider— implementsPhalcon\Html\Link\Interfaces\EvolvableLinkProviderInterface
Uses Phalcon\Html\Link\Interfaces\EvolvableLinkProviderInterface · Phalcon\Html\Link\Interfaces\LinkInterface
Method Summary¶
public static withLink( LinkInterface $link ) Returns an instance with the specified link included. public static withoutLink( LinkInterface $link ) Returns an instance with the specified link removed. Methods¶
withLink()¶
Returns an instance with the specified link included.
If the specified link is already present, this method MUST return normally without errors. The link is present if link is === identical to a link object already in the collection.
withoutLink()¶
Returns an instance with the specified link removed.
If the specified link is not present, this method MUST return normally without errors. The link is present if link is === identical to a link object already in the collection.
Html\Link\Interfaces\EvolvableLinkInterface¶
Interface Source on GitHub
An evolvable link value object.
Phalcon\Html\Link\Interfaces\LinkInterfacePhalcon\Html\Link\Interfaces\EvolvableLinkInterface
Method Summary¶
public EvolvableLinkInterface withAttribute(string $attribute,string $value) Returns an instance with the specified attribute added. public EvolvableLinkInterface withHref( string $href ) Returns an instance with the specified href. public EvolvableLinkInterface withRel( string $rel ) Returns an instance with the specified relationship included. public EvolvableLinkInterface withoutAttribute( string $attribute ) Returns an instance with the specified attribute excluded. public EvolvableLinkInterface withoutRel( string $rel ) Returns an instance with the specified relationship excluded. Methods¶
withAttribute()¶
Returns an instance with the specified attribute added.
If the specified attribute is already present, it will be overwritten with the new value.
withHref()¶
Returns an instance with the specified href.
An implementing library SHOULD evaluate a passed object to a string immediately rather than waiting for it to be returned later.
withRel()¶
Returns an instance with the specified relationship included.
If the specified rel is already present, this method MUST return normally without errors, but without adding the rel a second time.
withoutAttribute()¶
Returns an instance with the specified attribute excluded.
If the specified attribute is not present, this method MUST return normally without errors.
withoutRel()¶
Returns an instance with the specified relationship excluded.
If the specified rel is already not present, this method MUST return normally without errors.
Html\Link\Interfaces\EvolvableLinkProviderInterface¶
Interface Source on GitHub
An evolvable link provider value object.
Phalcon\Html\Link\Interfaces\LinkProviderInterfacePhalcon\Html\Link\Interfaces\EvolvableLinkProviderInterface
Method Summary¶
public EvolvableLinkProviderInterface withLink( LinkInterface $link ) Returns an instance with the specified link included. public EvolvableLinkProviderInterface withoutLink( LinkInterface $link ) Returns an instance with the specified link removed. Methods¶
withLink()¶
Returns an instance with the specified link included.
If the specified link is already present, this method MUST return normally without errors. The link is present if $link is === identical to a link object already in the collection.
withoutLink()¶
Returns an instance with the specified link removed.
If the specified link is not present, this method MUST return normally without errors. The link is present if $link is === identical to a link object already in the collection.
Html\Link\Interfaces\LinkInterface¶
Interface Source on GitHub
A readable link object.
Phalcon\Html\Link\Interfaces\LinkInterface
Method Summary¶
public array getAttributes() Returns a list of attributes that describe the target URI. public string getHref() Returns the target of the link. public array getRels() Returns the relationship type(s) of the link. public bool isTemplated() Returns whether this is a templated link. Methods¶
getAttributes()¶
Returns a list of attributes that describe the target URI.
getHref()¶
Returns the target of the link.
The target link must be one of: - An absolute URI, as defined by RFC 5988. - A relative URI, as defined by RFC 5988. The base of the relative link is assumed to be known based on context by the client. - A URI template as defined by RFC 6570.
If a URI template is returned, isTemplated() MUST return True.
getRels()¶
Returns the relationship type(s) of the link.
This method returns 0 or more relationship types for a link, expressed as an array of strings.
isTemplated()¶
Returns whether this is a templated link.
Html\Link\Interfaces\LinkProviderInterface¶
Interface Source on GitHub
A link provider object.
Phalcon\Html\Link\Interfaces\LinkProviderInterface
Method Summary¶
public array getLinks() Returns an array of LinkInterface objects. public array getLinksByRel( string $rel ) Returns an array of LinkInterface objects that have a specific Methods¶
getLinks()¶
Returns an array of LinkInterface objects.
getLinksByRel()¶
Returns an array of LinkInterface objects that have a specific relationship.
Html\Link\Link¶
Class Source on GitHub
Class Phalcon\Html\Link\Link
Phalcon\Html\Link\AbstractLinkPhalcon\Html\Link\Link— implementsPhalcon\Html\Link\Interfaces\LinkInterface
Uses Phalcon\Html\Link\Interfaces\LinkInterface
Method Summary¶
public array getAttributes() Returns a list of attributes that describe the target URI. public string getHref() Returns the target of the link. public array getRels() Returns the relationship type(s) of the link. public bool isTemplated() Returns whether or not this is a templated link. Methods¶
getAttributes()¶
Returns a list of attributes that describe the target URI.
getHref()¶
Returns the target of the link.
The target link must be one of: - An absolute URI, as defined by RFC 5988. - A relative URI, as defined by RFC 5988. The base of the relative link is assumed to be known based on context by the client. - A URI template as defined by RFC 6570.
If a URI template is returned, isTemplated() MUST return True.
getRels()¶
Returns the relationship type(s) of the link.
This method returns 0 or more relationship types for a link, expressed as an array of strings.
isTemplated()¶
Returns whether or not this is a templated link.
Html\Link\LinkProvider¶
Class Source on GitHub
@property LinkInterface[] links
Phalcon\Html\Link\AbstractLinkProviderPhalcon\Html\Link\LinkProvider— implementsPhalcon\Html\Link\Interfaces\LinkProviderInterface
Uses Phalcon\Html\Link\Interfaces\LinkInterface · Phalcon\Html\Link\Interfaces\LinkProviderInterface
Method Summary¶
public array getLinks() Returns an iterable of LinkInterface objects. public array getLinksByRel( mixed $rel ) Returns an iterable of LinkInterface objects that have a specific Methods¶
getLinks()¶
Returns an iterable of LinkInterface objects.
The iterable may be an array or any PHP \Traversable object. If no links are available, an empty array or \Traversable MUST be returned.
getLinksByRel()¶
Returns an iterable of LinkInterface objects that have a specific relationship.
The iterable may be an array or any PHP \Traversable object. If no links with that relationship are available, an empty array or \Traversable MUST be returned.
Html\Link\Serializer\Header¶
Class Source on GitHub
Class Phalcon\Http\Link\Serializer\Header
Phalcon\Html\Link\Serializer\Header— implementsPhalcon\Html\Link\Serializer\SerializerInterface
Method Summary¶
Methods¶
serialize()¶
Serializes all the passed links to a HTTP link header
Html\Link\Serializer\SerializerInterface¶
Interface Source on GitHub
Class Phalcon\Http\Link\Serializer\SerializerInterface
Phalcon\Html\Link\Serializer\SerializerInterface
Method Summary¶
Methods¶
serialize()¶
Serializer method
Html\TagFactory¶
Class Source on GitHub
ServiceLocator implementation for Tag helpers.
Built-in services are seeded by the constructor. Users may add or override services via set(), passing a Closure that returns the helper instance.
Helpers are cached per name after first construction.
@method string a(string $href, string $text, array $attributes = [], bool $raw = false) @method string aRaw(string $href, string $text, array $attributes = []) @method string base(string $href, array $attributes = []) @method string body(array $attributes = []) @method Breadcrumbs breadcrumbs(string $indent = ' ', string $delimiter = "\n") @method string button(string $text, array $attributes = [], bool $raw = false) @method string buttonRaw(string $text, array $attributes = []) @method string close(string $tag, bool $raw = false) @method Doctype doctype(int $type = Doctype::HTML5, string $delimiter = "\n") @method string element(string $tag, string $text, array $attributes = [], bool $raw = false) @method string elementRaw(string $tag, string $text, array $attributes = []) @method string form(array $attributes = []) @method string friendlyTitle(string $text, string $separator = '-', bool $lowercase = true, mixed $replace = null) @method string img(string $src, array $attributes = []) @method Checkbox inputCheckbox(string $name, string $value = null, array $attributes = []) @method CheckboxGroup inputCheckboxGroup(string $name, array $options, mixed $checked = null, array $attributes = []) @method Generic inputColor(string $name, string $value = null, array $attributes = []) @method Generic inputDate(string $name, string $value = null, array $attributes = []) @method Generic inputDateTime(string $name, string $value = null, array $attributes = []) @method Generic inputDateTimeLocal(string $name, string $value = null, array $attributes = []) @method Generic inputEmail(string $name, string $value = null, array $attributes = []) @method Generic inputFile(string $name, string $value = null, array $attributes = []) @method Generic inputHidden(string $name, string $value = null, array $attributes = []) @method Generic inputImage(string $name, string $value = null, array $attributes = []) @method Generic inputInput(string $name, string $value = null, array $attributes = []) @method Generic inputMonth(string $name, string $value = null, array $attributes = []) @method Generic inputNumeric(string $name, string $value = null, array $attributes = []) @method Generic inputPassword(string $name, string $value = null, array $attributes = []) @method Radio inputRadio(string $name, string $value = null, array $attributes = []) @method RadioGroup inputRadioGroup(string $name, array $options, mixed $checked = null, array $attributes = []) @method Generic inputRange(string $name, string $value = null, array $attributes = []) @method Generic inputSearch(string $name, string $value = null, array $attributes = []) @method Select inputSelect(string $name, string $value = null, array $attributes = []) @method Generic inputSubmit(string $name, string $value = null, array $attributes = []) @method Generic inputTel(string $name, string $value = null, array $attributes = []) @method Generic inputText(string $name, string $value = null, array $attributes = []) @method Textarea inputTextarea(string $name, string $value = null, array $attributes = []) @method Generic inputTime(string $name, string $value = null, array $attributes = []) @method Generic inputUrl(string $name, string $value = null, array $attributes = []) @method Generic inputWeek(string $name, string $value = null, array $attributes = []) @method string label(string $label, array $attributes = [], bool $raw = false) @method string labelRaw(string $label, array $attributes = []) @method Link link(string $indent = ' ', string $delimiter = "\n") @method Meta meta(string $indent = ' ', string $delimiter = "\n") @method Ol ol(string $indent = ' ', string $delimiter = null, array $attributes = []) @method Ol olRaw(string $indent = ' ', string $delimiter = null, array $attributes = []) @method string preload(string $href, string $type = 'style', array $attributes = []) @method Script script(string $indent = ' ', string $delimiter = "\n") @method Style style(string $indent = ' ', string $delimiter = "\n") @method string tag(string $name, array $attributes = []) @method Title title(string $indent = ' ', string $delimiter = "\n") @method Ul ul(string $indent = ' ', string $delimiter = null, array $attributes = []) @method Ul ulRaw(string $indent = ' ', string $delimiter = null, array $attributes = []) @method string voidTag(string $name, array $attributes = [])
Phalcon\Html\TagFactory
Uses Closure · Phalcon\Html\Escaper\EscaperInterface · Phalcon\Html\Exceptions\ServiceNotRegistered · Phalcon\Html\Helper\Anchor · Phalcon\Html\Helper\Base · Phalcon\Html\Helper\Body · Phalcon\Html\Helper\Breadcrumbs · Phalcon\Html\Helper\Button · Phalcon\Html\Helper\Close · Phalcon\Html\Helper\Doctype · Phalcon\Html\Helper\Element · Phalcon\Html\Helper\Form · Phalcon\Html\Helper\FriendlyTitle · Phalcon\Html\Helper\Img · Phalcon\Html\Helper\Input\Checkbox · Phalcon\Html\Helper\Input\CheckboxGroup · Phalcon\Html\Helper\Input\Generic · Phalcon\Html\Helper\Input\Radio · Phalcon\Html\Helper\Input\RadioGroup · Phalcon\Html\Helper\Input\Select · Phalcon\Html\Helper\Input\Textarea · Phalcon\Html\Helper\Label · Phalcon\Html\Helper\Link · Phalcon\Html\Helper\Meta · Phalcon\Html\Helper\Ol · Phalcon\Html\Helper\Preload · Phalcon\Html\Helper\Script · Phalcon\Html\Helper\Style · Phalcon\Html\Helper\Tag · Phalcon\Html\Helper\Title · Phalcon\Html\Helper\Ul · Phalcon\Html\Helper\VoidTag · Phalcon\Http\ResponseInterface · Phalcon\Mvc\Url\UrlInterface
Method Summary¶
public __call(string $name,array $arguments) Magic call to make the helper objects available as methods. public __construct(EscaperInterface $escaper,array $services = [],ResponseInterface $response = null,UrlInterface $url = null) TagFactory constructor. public bool has( string $name ) public object newInstance( string $name ) Create or return a cached instance of the helper. public void set(string $name,Closure $definition) Register a helper via a zero-argument Closure. The Closure is invoked on protected array getDefaultServices() Default service recipes. Every entry is a Closure that returns a Properties¶
protected array $factories = [] protected array $instances = [] Methods¶
__call()¶
Magic call to make the helper objects available as methods.
__construct()¶
public function __construct(
EscaperInterface $escaper,
array $services = [],
ResponseInterface $response = null,
UrlInterface $url = null
);
TagFactory constructor.
has()¶
newInstance()¶
Create or return a cached instance of the helper.
set()¶
Register a helper via a zero-argument Closure. The Closure is invoked on the first matching newInstance() call and its return value is cached. Passing a new definition clears any cached instance so the next call to newInstance() rebuilds it.
getDefaultServices()¶
Default service recipes. Every entry is a Closure that returns a fully-constructed helper instance. Services are built lazily and cached.