Phalcon html
NOTE
All classes are prefixed with Phalcon
Html\Attributes¶
-
Namespace
Phalcon\Html
-
Uses
Phalcon\Html\Attributes\RenderInterfacePhalcon\Support\Collection
-
Extends
Collection -
Implements
RenderInterface
This class helps to work with HTML Attributes
Methods¶
Alias of the render method Render attributes as HTML attributes @todo remove this when we refactor forms. Maybe remove this class? Put it into traitsHtml\Attributes\AttributesInterface
¶
-
Namespace
Phalcon\Html\Attributes
-
Uses
Phalcon\Html\Attributes
-
Extends
-
Implements
-
Phalcon\Html\Attributes\AttributesInterface *
- Interface Phalcon\Html\Attributes\AttributesInterface */
Methods¶
Get Attributes Set AttributesHtml\Attributes\RenderInterface
¶
-
Namespace
Phalcon\Html\Attributes
-
Uses
-
Extends
-
Implements
-
Phalcon\Html\Attributes\RenderInterface *
- Interface Phalcon\Html\Attributes\RenderInterface */
Methods¶
Generate a string represetationHtml\Breadcrumbs¶
-
Namespace
Phalcon\Html
-
Uses
Phalcon\Di\DiInterface
-
Extends
-
Implements
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.
@deprecated Will be removed in future version Use {@see Phalcon\Html\Helper\Breadcrumbs} instead.
Properties¶
/**
* Keeps all the breadcrumbs
*
* @var array
*/
private $elements;
/**
* Crumb separator
*
* @var string
*/
private $separator = / ;
/**
* The HTML template to use to render the breadcrumbs.
*
* @var string
*/
private $template = <dt><a href=\"%link%\">%label%</a></dt>;
Methods¶
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");
$breadcrumbs->remove("/admin/user/create");
// remove a crumb without an url (last link)
$breadcrumbs->remove();
Html\Escaper¶
-
Namespace
Phalcon\Html
-
Uses
Phalcon\Html\Escaper\AttributeEscaperPhalcon\Html\Escaper\CssEscaperPhalcon\Html\Escaper\EscaperInterfacePhalcon\Html\Escaper\HtmlEscaperPhalcon\Html\Escaper\JsEscaperPhalcon\Html\Escaper\UrlEscaper
-
Extends
-
Implements
EscaperInterface
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
Properties¶
/**
* @var AttributeEscaper
*/
protected $attributeEscaper;
/**
* @var CssEscaper
*/
protected $cssEscaper;
/**
* @var HtmlEscaper
*/
protected $htmlEscaper;
/**
* @var JsEscaper
*/
protected $jsEscaper;
/**
* @var UrlEscaper
*/
protected $urlEscaper;
Methods¶
Escapes a HTML attribute string or array. Delegates to the configuredAttributeEscaper. Escape CSS strings. Delegates to the configured CssEscaper. Escapes a HTML string. Delegates to the configured HtmlEscaper. Escape javascript strings. Delegates to the configured JsEscaper. Sets the double_encode flag. Fans out to all sub-objects. Sets the encoding. Fans out to all sub-objects. Sets the htmlspecialchars flags. Fans out to all sub-objects. Escapes a URL. Delegates to the configured UrlEscaper. Html\Escaper\AbstractEscaper
¶
-
Namespace
Phalcon\Html\Escaper
-
Uses
-
Extends
-
Implements
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
Properties¶
/**
* @var bool
*/
protected $doubleEncode = true;
/**
* @var string
*/
protected $encoding = utf-8;
/**
* ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401
*
* @var int
*/
protected $flags = 11;
Methods¶
Detects the character encoding of a string. Special-handling for chr(172) and chr(128) to chr(159) which fail to be detected bymb_detect_encoding(). Normalizes a string's encoding to UTF-32, used by the CSS and JS escapers before invoking the C-level escape routines. Html\Escaper\AttributeEscaper¶
-
Namespace
Phalcon\Html\Escaper
-
Uses
-
Extends
AbstractEscaper -
Implements
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.
Methods¶
Encodes a single key/value viahtmlspecialchars. Html\Escaper\CssEscaper¶
-
Namespace
Phalcon\Html\Escaper
-
Uses
-
Extends
AbstractEscaper -
Implements
Escapes a string for use inside a CSS value by replacing non-alphanumeric characters with their hexadecimal escape sequence. Wraps the C-level phalcon_escape_css after normalising the input to UTF-32.
Methods¶
Html\Escaper\EscaperInterface
¶
-
Namespace
Phalcon\Html\Escaper
-
Uses
-
Extends
-
Implements
Interface for Phalcon\Html\Escaper
Methods¶
Escapes a HTML attribute string Escape CSS strings by replacing non-alphanumeric chars by their hexadecimal representation Returns the internal encoding used by the escaper Escapes a HTML string Escape Javascript strings by replacing non-alphanumeric chars by their hexadecimal representation Sets the encoding to be used by the escaper Sets the HTML quoting type for htmlspecialchars Escapes a URL. Internally uses rawurlencodeHtml\Escaper\Exception¶
-
Namespace
Phalcon\Html\Escaper
-
Uses
-
Extends
\Exception -
Implements
Exceptions thrown in Phalcon\Html\Escaper will use this class
Html\Escaper\HtmlEscaper¶
-
Namespace
Phalcon\Html\Escaper
-
Uses
-
Extends
AbstractEscaper -
Implements
Escapes a string for use as HTML body content via htmlspecialchars.
Methods¶
Html\Escaper\JsEscaper¶
-
Namespace
Phalcon\Html\Escaper
-
Uses
-
Extends
AbstractEscaper -
Implements
Escapes a string for use inside a JavaScript context by replacing non-alphanumeric characters with their hexadecimal escape sequence. Wraps the C-level phalcon_escape_js after normalising the input to UTF-32.
Methods¶
Html\Escaper\UrlEscaper¶
-
Namespace
Phalcon\Html\Escaper
-
Uses
-
Extends
AbstractEscaper -
Implements
Escapes a string for use as a URL component via rawurlencode. The encoding/flags/doubleEncode setters are accepted for symmetry with the other contexts but have no effect on the output.
Methods¶
Html\EscaperFactory¶
-
Namespace
Phalcon\Html
-
Uses
-
Extends
-
Implements
Class EscaperFactory
Methods¶
Create a new instance of the objectHtml\Exception¶
-
Namespace
Phalcon\Html
-
Uses
-
Extends
\Exception -
Implements
Phalcon\Html\Tag\Exception
Exceptions thrown in Phalcon\Html\Tag will use this class
Html\Helper\AbstractHelper
¶
-
Namespace
Phalcon\Html\Helper
-
Uses
Phalcon\Html\Escaper\EscaperInterfacePhalcon\Html\Exception
-
Extends
-
Implements
@property string $delimiter @property EscaperInterface $escaper @property string $indent @property int $indentLevel
Properties¶
/**
* @var string
*/
protected $delimiter = ;
/**
* @var Doctype|null
*/
protected $doctype;
/**
* @var EscaperInterface
*/
protected $escaper;
/**
* @var string
*/
protected $indent = ;
/**
* @var int
*/
protected $indentLevel = 1;
Methods¶
AbstractHelper constructor. Produces a closing tag Replicates the indent x times as per indentLevel 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. Keeps all the attributes sorted - same order all the tome Traverses an array and calls the method defined in the first element with attributes as the second, returning the resulting string Renders all the attributes Renders an element protected function renderFullElement( string $tag, string $text, array $attributes = [], bool $raw = bool ): string;
protected function renderTag( string $tag, array $attributes = [], string $close = string ): string;
Html\Helper\AbstractList
¶
-
Namespace
Phalcon\Html\Helper
-
Uses
Phalcon\Html\Exception
-
Extends
AbstractHelper -
Implements
Class AbstractList
Properties¶
/**
* @var array
*/
protected $attributes;
/**
* @var string
*/
protected $elementTag = li;
/**
* @var array
*/
protected $store;
Methods¶
public function __invoke( string $indent = string, string $delimiter = null, array $attributes = [] ): AbstractList;
Html\Helper\AbstractSeries
¶
-
Namespace
Phalcon\Html\Helper
-
Uses
-
Extends
AbstractHelper -
Implements
@property array $attributes @property array $store
Properties¶
Methods¶
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. Resets the internal store. Returns the tag name. Appends an entry to the store, optionally at a specific integer position. Whenposition 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¶
-
Namespace
Phalcon\Html\Helper
-
Uses
Phalcon\Html\Escaper\EscaperInterfacePhalcon\Html\Exception
-
Extends
AbstractHelper -
Implements
Class Anchor
@property bool $forceRaw
Properties¶
Methods¶
public function __construct( EscaperInterface $escaper, Doctype $doctype = null, bool $forceRaw = bool );
public function __invoke( string $href, string $text, array $attributes = [], bool $raw = bool ): string;
Html\Helper\Base¶
-
Namespace
Phalcon\Html\Helper
-
Uses
Phalcon\Html\Exception
-
Extends
AbstractHelper -
Implements
Class Base
Methods¶
Produce a<base/> tag. Html\Helper\Body¶
-
Namespace
Phalcon\Html\Helper
-
Uses
Phalcon\Html\Exception
-
Extends
AbstractHelper -
Implements
Class Body
Methods¶
Produce a<body> tag. Html\Helper\Breadcrumbs¶
-
Namespace
Phalcon\Html\Helper
-
Uses
Phalcon\Html\Escaper\EscaperInterfacePhalcon\Mvc\Url\UrlInterfacePhalcon\Support\Helper\Str\Interpolate
-
Extends
AbstractHelper -
Implements
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.
@phpstan-type TTemplate array{ main: string, line: string, last: string } @phpstan-type TElement array{ attributes: array
Properties¶
/**
* @var array<string, string>
*/
private $attributes;
/**
* Link prefix prepended to every non-empty link during rendering.
* Auto-populated from the Url service when one is injected.
*
* @var string
*/
private $prefix = ;
/**
* Optional Url service used to resolve links via get().
* When set, takes priority over the string prefix.
*
* @var UrlInterface|null
*/
private $url;
/**
* Keeps all the breadcrumbs.
*
* @var array<int, TElement>
*/
private $data;
/**
* Crumb separator.
*
* @var string
*/
private $separator = <li>/</li>;
/**
* The HTML template to use to render the breadcrumbs.
*
* @var TTemplate
*/
private $template;
/**
* The HTML template to use to render the breadcrumbs.
*
* @var Interpolate
*/
private $interpolator;
Methods¶
AbstractHelper constructor. Sets the indent and delimiter and returns the object back.public function add( string $text, string $link = string, string $icon = string, array $attributes = [] ): Breadcrumbs;
// 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");
Html\Helper\Button¶
-
Namespace
Phalcon\Html\Helper
-
Uses
Phalcon\Html\Escaper\EscaperInterfacePhalcon\Html\Exception
-
Extends
AbstractHelper -
Implements
Class Button
@property bool $forceRaw
Properties¶
Methods¶
public function __construct( EscaperInterface $escaper, Doctype $doctype = null, bool $forceRaw = bool );
<button> tag. Html\Helper\Close¶
-
Namespace
Phalcon\Html\Helper
-
Uses
-
Extends
AbstractHelper -
Implements
Class Close
Methods¶
Produce a</...> tag. Html\Helper\Doctype¶
-
Namespace
Phalcon\Html\Helper
-
Uses
-
Extends
-
Implements
Creates Doctype tags
Constants¶
const HTML32 = 1;
const HTML401_FRAMESET = 4;
const HTML401_STRICT = 2;
const HTML401_TRANSITIONAL = 3;
const HTML5 = 5;
const XHTML10_FRAMESET = 8;
const XHTML10_STRICT = 6;
const XHTML10_TRANSITIONAL = 7;
const XHTML11 = 9;
const XHTML20 = 10;
const XHTML5 = 11;
Properties¶
Methods¶
public function __invoke( int $type = static-constant-access, string $delimiter = string ): Doctype;
Html\Helper\Element¶
-
Namespace
Phalcon\Html\Helper
-
Uses
Phalcon\Html\Escaper\EscaperInterfacePhalcon\Html\Exception
-
Extends
AbstractHelper -
Implements
Class Element
@property bool $forceRaw
Properties¶
Methods¶
public function __construct( EscaperInterface $escaper, Doctype $doctype = null, bool $forceRaw = bool );
public function __invoke( string $tag, string $text, array $attributes = [], bool $raw = bool ): string;
Html\Helper\Form¶
-
Namespace
Phalcon\Html\Helper
-
Uses
Phalcon\Html\Exception
-
Extends
AbstractHelper -
Implements
Class Form
Methods¶
Produce a<form> tag. Html\Helper\FriendlyTitle¶
-
Namespace
Phalcon\Html\Helper
-
Uses
Phalcon\Html\Escaper\EscaperInterfacePhalcon\Html\ExceptionPhalcon\Support\Helper\Str\Friendly
-
Extends
AbstractHelper -
Implements
Converts text to a URL-friendly slug.
Properties¶
Methods¶
public function __invoke( string $text, string $separator = string, bool $lowercase = bool, mixed $replace = null ): string;
Html\Helper\Img¶
-
Namespace
Phalcon\Html\Helper
-
Uses
Phalcon\Html\Exception
-
Extends
AbstractHelper -
Implements
Class Img
Methods¶
Produce aHtml\Helper\Input\AbstractChecked
¶
-
Namespace
Phalcon\Html\Helper\Input
-
Uses
Phalcon\Html\Escaper\EscaperInterfacePhalcon\Html\Helper\Doctype
-
Extends
AbstractInput -
Implements
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
Properties¶
Methods¶
Returns the HTML for the input, optionally surrounded by the label fragment configured vialabel() and preceded by the hidden companion input emitted when an unchecked attribute is supplied. 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. 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. 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)). Returns the markup for the optional hidden companion input that lets a checkbox/radio submit a value when unchecked. Html\Helper\Input\AbstractGroup
¶
-
Namespace
Phalcon\Html\Helper\Input
-
Uses
Phalcon\Html\Helper\AbstractHelper
-
Extends
AbstractHelper -
Implements
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
Properties¶
/**
* @var mixed
*/
protected $checked;
/**
* @var string
*/
protected $name = ;
/**
* @var array
*/
protected $options;
/**
* @var array
*/
protected $sharedAttributes;
/**
* @var string
*/
protected $type = checkbox;
Methods¶
public function __invoke( string $name, array $options, mixed $checked = null, array $attributes = [] ): AbstractGroup;
Html\Helper\Input\AbstractInput
¶
-
Namespace
Phalcon\Html\Helper\Input
-
Uses
Phalcon\Html\Helper\AbstractHelperPhalcon\Html\Helper\Doctype
-
Extends
AbstractHelper -
Implements
Class AbstractInput
@property array $attributes @property string $type @property string $value
Properties¶
Methods¶
public function __invoke( string $name, string $value = null, array $attributes = [] ): AbstractInput;
Html\Helper\Input\Checkbox¶
-
Namespace
Phalcon\Html\Helper\Input
-
Uses
-
Extends
AbstractChecked -
Implements
Renders an <input type="checkbox">. Behavior (label wrapping, unchecked companion, loose-by-default checked match) lives in AbstractChecked.
Properties¶
Html\Helper\Input\CheckboxGroup¶
-
Namespace
Phalcon\Html\Helper\Input
-
Uses
-
Extends
AbstractGroup -
Implements
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).
Properties¶
Methods¶
Returns true when $value appears in the checked list.Html\Helper\Input\Generic¶
-
Namespace
Phalcon\Html\Helper\Input
-
Uses
Phalcon\Html\Escaper\EscaperInterfacePhalcon\Html\Helper\Doctype
-
Extends
AbstractInput -
Implements
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().
Methods¶
public function __construct( EscaperInterface $escaper, Doctype $doctype = null, string $type = string );
Html\Helper\Input\Radio¶
-
Namespace
Phalcon\Html\Helper\Input
-
Uses
-
Extends
AbstractChecked -
Implements
Renders an <input type="radio">. Behavior (label wrapping, unchecked companion, loose-by-default checked match) lives in AbstractChecked.
Properties¶
Html\Helper\Input\RadioGroup¶
-
Namespace
Phalcon\Html\Helper\Input
-
Uses
-
Extends
AbstractGroup -
Implements
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.
Properties¶
Methods¶
Returns true when $value loosely equals the checked scalar.Html\Helper\Input\Select¶
-
Namespace
Phalcon\Html\Helper\Input
-
Uses
Phalcon\Contracts\Html\Helper\Input\SelectDataPhalcon\Html\Helper\AbstractList
-
Extends
AbstractList -
Implements
Class Select
Properties¶
/**
* @var string
*/
protected $elementTag = option;
/**
* @var bool
*/
protected $inOptGroup = false;
/**
* @var string
*/
protected $selected = ;
/**
* @var bool
*/
protected $strict = false;
Methods¶
public function add( string $text, string $value = null, array $attributes = [], bool $raw = bool ): Select;
public function addPlaceholder( string $text, mixed $value = null, array $attributes = [], bool $raw = bool ): Select;
Flat entries: key = option value, value = label string. Optgroup entries: key = group label, value = [value => label] array.
Creates an option group 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. 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. Html\Helper\Input\Select\ArrayData¶
-
Namespace
Phalcon\Html\Helper\Input\Select
-
Uses
Phalcon\Contracts\Html\Helper\Input\SelectData
-
Extends
-
Implements
SelectData
Wraps a plain PHP array as a SELECT data provider.
Keys are option values; string values are labels; array values define optgroups.
Properties¶
Methods¶
Html\Helper\Input\Select\ResultsetData¶
-
Namespace
Phalcon\Html\Helper\Input\Select
-
Uses
InvalidArgumentExceptionPhalcon\Contracts\Html\Helper\Input\SelectDataPhalcon\Mvc\Model\ResultsetInterface
-
Extends
-
Implements
SelectData
This file is part of the Phalcon Framework.
(c) Phalcon Team team@phalcon.io
For the full copyright and license information, please view the LICENSE.txt file that was distributed with this source code.
Implementation of this file has been influenced by AuraPHP @link https://github.com/auraphp/Aura.Html @license https://github.com/auraphp/Aura.Html/blob/2.x/LICENSE
Properties¶
/**
* @var array
*/
protected $attributesMap;
/**
* @var array|null
*/
protected $resolvedAttributes;
/**
* @var array|null
*/
protected $resolvedOptions;
/**
* @var ResultsetInterface
*/
protected $resultset;
/**
* @var array
*/
protected $using;
Methods¶
public function __construct( ResultsetInterface $resultset, array $using, array $attributesMap = [] );
readAttribute when present) and plain arrays. Walks the resultset once, building both the option map and the per-option resolved attribute map. Closures in attributesMap receive the current row; string values are passed through. Html\Helper\Input\Textarea¶
-
Namespace
Phalcon\Html\Helper\Input
-
Uses
Phalcon\Html\Exception
-
Extends
AbstractInput -
Implements
Class Textarea
Properties¶
Methods¶
Returns the HTML for the input.Html\Helper\Label¶
-
Namespace
Phalcon\Html\Helper
-
Uses
Phalcon\Html\Escaper\EscaperInterfacePhalcon\Html\Exception
-
Extends
AbstractHelper -
Implements
Class Label
@property bool $forceRaw
Properties¶
Methods¶
public function __construct( EscaperInterface $escaper, Doctype $doctype = null, bool $forceRaw = bool );
<label> tag. Html\Helper\Link¶
-
Namespace
Phalcon\Html\Helper
-
Uses
-
Extends
Style -
Implements
Creates tags
Methods¶
Add an element to the list Returns the necessary attributesHtml\Helper\Meta¶
-
Namespace
Phalcon\Html\Helper
-
Uses
Phalcon\Html\Exception
-
Extends
AbstractSeries -
Implements
Class Meta
Methods¶
Add an element to the listHtml\Helper\Ol¶
-
Namespace
Phalcon\Html\Helper
-
Uses
Phalcon\Html\Escaper\EscaperInterface
-
Extends
AbstractList -
Implements
Class Ol
@property bool $forceRaw
Properties¶
Methods¶
public function __construct( EscaperInterface $escaper, Doctype $doctype = null, bool $forceRaw = bool );
Html\Helper\Preload¶
-
Namespace
Phalcon\Html\Helper
-
Uses
Phalcon\Html\Escaper\EscaperInterfacePhalcon\Html\Link\LinkPhalcon\Html\Link\Serializer\HeaderPhalcon\Http\ResponseInterface
-
Extends
AbstractHelper -
Implements
Generates a tag for resource hinting. If a ResponseInterface is provided, also sets the HTTP Link header.
Properties¶
Methods¶
Html\Helper\Script¶
-
Namespace
Phalcon\Html\Helper
-
Uses
Phalcon\Html\Exception
-
Extends
AbstractSeries -
Implements
Class Script
Methods¶
Add an element to the list Begins capturing inline script content via output buffering. Pair withendInternal() to close the buffer and append the captured markup as a <script>...</script> block in the asset stack. 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). Returns the necessary attributes Html\Helper\Style¶
-
Namespace
Phalcon\Html\Helper
-
Uses
Phalcon\Html\Exception
-
Extends
AbstractSeries -
Implements
Class Style
Properties¶
Methods¶
Add an element to the list Sets if this is a style or link tag Returns the necessary attributesHtml\Helper\Tag¶
-
Namespace
Phalcon\Html\Helper
-
Uses
Phalcon\Html\Exception
-
Extends
AbstractHelper -
Implements
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.
Methods¶
Html\Helper\Title¶
-
Namespace
Phalcon\Html\Helper
-
Uses
Phalcon\Html\Exception
-
Extends
AbstractHelper -
Implements
Class Title
@property array $append @property string $delimiter @property string $indent @property array $prepend @property string $title @property string $separator
Properties¶
/**
* @var array
*/
protected $append;
/**
* @var array
*/
protected $prepend;
/**
* @var string
*/
protected $title = ;
/**
* @var string
*/
protected $separator = ;
Methods¶
Sets the separator and returns the object back Returns the title tags Appends text to current document title Returns the title Prepends text to current document title Sets the title Sets the separatorHtml\Helper\Ul¶
-
Namespace
Phalcon\Html\Helper
-
Uses
-
Extends
Ol -
Implements
Class Ul
Methods¶
Html\Helper\VoidTag¶
-
Namespace
Phalcon\Html\Helper
-
Uses
Phalcon\Html\Exception
-
Extends
AbstractHelper -
Implements
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.
Methods¶
Html\Link\AbstractLink
¶
-
Namespace
Phalcon\Html\Link
-
Uses
Phalcon\Support\Collection
-
Extends
-
Implements
@property array $attributes @property string $href @property array $rels @property bool $templated
Properties¶
/**
* @var Collection
*/
protected $attributes;
/**
* @var string
*/
protected $href = ;
/**
* @var Collection
*/
protected $rels;
/**
* @var bool
*/
protected $templated = false;
Methods¶
Link constructor. Returns a list of attributes that describe the target URI. 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.
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.
Returns whether this is a templated link. Determines if a href is a templated link or not.@see https://tools.ietf.org/html/rfc6570
Html\Link\AbstractLinkProvider
¶
-
Namespace
Phalcon\Html\Link
-
Uses
Phalcon\Html\Link\Interfaces\LinkInterface
-
Extends
-
Implements
@property array $links
Properties¶
Methods¶
LinkProvider constructor. 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.
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.
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.
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.
Returns the object hash keyHtml\Link\EvolvableLink¶
-
Namespace
Phalcon\Html\Link
-
Uses
Phalcon\Html\Link\Interfaces\EvolvableLinkInterface
-
Extends
Link -
Implements
EvolvableLinkInterface
Class Phalcon\Http\Link\EvolvableLink
@property array attributes @property string href @property array rels @property bool templated
Methods¶
Returns an instance with the specified attribute added.If the specified attribute is already present, it will be overwritten with the new value.
Returns an instance with the specified href. 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.
Returns an instance with the specified attribute excluded.If the specified attribute is not present, this method MUST return normally without errors.
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¶
-
Namespace
Phalcon\Html\Link
-
Uses
Phalcon\Html\Link\Interfaces\EvolvableLinkProviderInterfacePhalcon\Html\Link\Interfaces\LinkInterface
-
Extends
LinkProvider -
Implements
EvolvableLinkProviderInterface
Class Phalcon\Http\Link\LinkProvider
@property LinkInterface[] links
Methods¶
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.
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
¶
-
Namespace
Phalcon\Html\Link\Interfaces
-
Uses
-
Extends
LinkInterface -
Implements
An evolvable link value object.
Methods¶
Returns an instance with the specified attribute added.If the specified attribute is already present, it will be overwritten with the new value.
Returns an instance with the specified href. 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.
Returns an instance with the specified attribute excluded.If the specified attribute is not present, this method MUST return normally without errors.
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
¶
-
Namespace
Phalcon\Html\Link\Interfaces
-
Uses
-
Extends
LinkProviderInterface -
Implements
An evolvable link provider value object.
Methods¶
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.
Returns an instance with the specifed 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
¶
-
Namespace
Phalcon\Html\Link\Interfaces
-
Uses
-
Extends
-
Implements
A readable link object.
Methods¶
Returns a list of attributes that describe the target URI. 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.
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.
Returns whether this is a templated link.Html\Link\Interfaces\LinkProviderInterface
¶
-
Namespace
Phalcon\Html\Link\Interfaces
-
Uses
-
Extends
-
Implements
A link provider object.
Methods¶
Returns an array of LinkInterface objects. Returns an array of LinkInterface objects that have a specific relationship.Html\Link\Link¶
-
Namespace
Phalcon\Html\Link
-
Uses
Phalcon\Html\Link\Interfaces\LinkInterfacePhalcon\Support\CollectionPhalcon\Support\Collection\CollectionInterface
-
Extends
AbstractLink -
Implements
LinkInterface
Class Phalcon\Http\Link\Link
@property array attributes @property string href @property array rels @property bool templated
Methods¶
Returns a list of attributes that describe the target URI. 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.
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.
Returns whether or not this is a templated link.Html\Link\LinkProvider¶
-
Namespace
Phalcon\Html\Link
-
Uses
Phalcon\Html\Link\Interfaces\LinkInterfacePhalcon\Html\Link\Interfaces\LinkProviderInterface
-
Extends
AbstractLinkProvider -
Implements
LinkProviderInterface
@property LinkInterface[] links
Methods¶
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.
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¶
-
Namespace
Phalcon\Html\Link\Serializer
-
Uses
-
Extends
-
Implements
SerializerInterface
Class Phalcon\Http\Link\Serializer\Header
Methods¶
Serializes all the passed links to a HTTP link headerHtml\Link\Serializer\SerializerInterface
¶
-
Namespace
Phalcon\Html\Link\Serializer
-
Uses
-
Extends
-
Implements
Class Phalcon\Http\Link\Serializer\SerializerInterface
Methods¶
Serializer methodHtml\TagFactory¶
-
Namespace
Phalcon\Html
-
Uses
ClosurePhalcon\Html\Escaper\EscaperInterfacePhalcon\Html\Helper\AnchorPhalcon\Html\Helper\BasePhalcon\Html\Helper\BodyPhalcon\Html\Helper\BreadcrumbsPhalcon\Html\Helper\ButtonPhalcon\Html\Helper\ClosePhalcon\Html\Helper\DoctypePhalcon\Html\Helper\ElementPhalcon\Html\Helper\FormPhalcon\Html\Helper\FriendlyTitlePhalcon\Html\Helper\ImgPhalcon\Html\Helper\Input\CheckboxPhalcon\Html\Helper\Input\CheckboxGroupPhalcon\Html\Helper\Input\GenericPhalcon\Html\Helper\Input\RadioPhalcon\Html\Helper\Input\RadioGroupPhalcon\Html\Helper\Input\SelectPhalcon\Html\Helper\Input\TextareaPhalcon\Html\Helper\LabelPhalcon\Html\Helper\LinkPhalcon\Html\Helper\MetaPhalcon\Html\Helper\OlPhalcon\Html\Helper\PreloadPhalcon\Html\Helper\ScriptPhalcon\Html\Helper\StylePhalcon\Html\Helper\TagPhalcon\Html\Helper\TitlePhalcon\Html\Helper\UlPhalcon\Html\Helper\VoidTagPhalcon\Http\ResponseInterfacePhalcon\Mvc\Url\UrlInterface
-
Extends
-
Implements
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 = [])
Properties¶
/**
* @var Doctype
*/
private $doctype;
/**
* @var EscaperInterface
*/
private $escaper;
/**
* @var ResponseInterface|null
*/
private $response;
/**
* @var UrlInterface|null
*/
private $url;
/**
* @var array
*/
protected $factories;
/**
* @var array
*/
protected $instances;
Methods¶
Magic call to make the helper objects available as methods.public function __construct( EscaperInterface $escaper, array $services = [], ResponseInterface $response = null, UrlInterface $url = null );
@phpstan-param array
newInstance() call and its return value is cached. Passing a new definition clears any cached instance so the next call to newInstance() rebuilds it. Default service recipes. Every entry is a Closure that returns a fully-constructed helper instance. Services are built lazily and cached.