Skip to content

Phalcon html

NOTE

All classes are prefixed with Phalcon

Html\Attributes

Source on GitHub

  • Namespace

    • Phalcon\Html
  • Uses

    • Phalcon\Html\Attributes\RenderInterface
    • Phalcon\Support\Collection
  • Extends

    Collection

  • Implements

    • RenderInterface

This class helps to work with HTML Attributes

Methods

public function __toString(): string;
Alias of the render method

public function render(): string;
Render attributes as HTML attributes

protected function renderAttributes( array $attributes ): string;
@todo remove this when we refactor forms. Maybe remove this class? Put it into traits

Html\Attributes\AttributesInterface Interface

Source on GitHub

  • Namespace

    • Phalcon\Html\Attributes
  • Uses

    • Phalcon\Html\Attributes
  • Extends

  • Implements

  • Phalcon\Html\Attributes\AttributesInterface *

  • Interface Phalcon\Html\Attributes\AttributesInterface */

Methods

public function getAttributes(): Attributes;
Get Attributes

public function setAttributes( Attributes $attributes ): AttributesInterface;
Set Attributes

Html\Attributes\RenderInterface Interface

Source on GitHub

  • Namespace

    • Phalcon\Html\Attributes
  • Uses

  • Extends

  • Implements

  • Phalcon\Html\Attributes\RenderInterface *

  • Interface Phalcon\Html\Attributes\RenderInterface */

Methods

public function render(): string;
Generate a string represetation

Html\Breadcrumbs

Source on GitHub

  • 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

public function add( string $label, string $link = string ): Breadcrumbs;
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");

public function clear(): void;
Clears the crumbs

$breadcrumbs->clear()

public function getSeparator(): string;
Crumb separator

public function remove( string $link ): void;
Removes crumb by url.

$breadcrumbs->remove("/admin/user/create");

// remove a crumb without an url (last link)
$breadcrumbs->remove();

public function render(): string;
Renders and outputs breadcrumbs based on previously set template.

echo $breadcrumbs->render();
public function setSeparator( string $separator ): Breadcrumbs;

public function toArray(): array;
Returns the internal breadcrumbs array

Html\Escaper

Source on GitHub

  • Namespace

    • Phalcon\Html
  • 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
  • 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

public function __construct();

public function attributes( mixed $input ): string;
Escapes a HTML attribute string or array. Delegates to the configured AttributeEscaper.

public function css( string $input ): string;
Escape CSS strings. Delegates to the configured CssEscaper.

final public function detectEncoding( string $input ): string | null;
public function escapeCss( string $input ): string;
public function escapeHtml( string $input = null ): string;
public function escapeHtmlAttr( string $input = null ): string;
public function escapeJs( string $input ): string;
public function escapeUrl( string $input ): string;
public function getAttributeEscaper(): AttributeEscaper;
public function getCssEscaper(): CssEscaper;
public function getEncoding(): string;
public function getFlags(): int;
public function getHtmlEscaper(): HtmlEscaper;
public function getJsEscaper(): JsEscaper;
public function getUrlEscaper(): UrlEscaper;

public function html( string $input = null ): string;
Escapes a HTML string. Delegates to the configured HtmlEscaper.

public function js( string $input ): string;
Escape javascript strings. Delegates to the configured JsEscaper.

final public function normalizeEncoding( string $input ): string;
public function setAttributeEscaper( AttributeEscaper $escaper ): Escaper;
public function setCssEscaper( CssEscaper $escaper ): Escaper;

public function setDoubleEncode( bool $doubleEncode ): Escaper;
Sets the double_encode flag. Fans out to all sub-objects.

public function setEncoding( string $encoding ): EscaperInterface;
Sets the encoding. Fans out to all sub-objects.

public function setFlags( int $flags ): EscaperInterface;
Sets the htmlspecialchars flags. Fans out to all sub-objects.

public function setHtmlEscaper( HtmlEscaper $escaper ): Escaper;
public function setHtmlQuoteType( int $flags ): EscaperInterface;
public function setJsEscaper( JsEscaper $escaper ): Escaper;
public function setUrlEscaper( UrlEscaper $escaper ): Escaper;

public function url( string $input ): string;
Escapes a URL. Delegates to the configured UrlEscaper.

Html\Escaper\AbstractEscaper Abstract

Source on GitHub

  • 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

final public function detectEncoding( string $input ): string | null;
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().

public function getDoubleEncode(): bool;
public function getEncoding(): string;
public function getFlags(): int;

final public function normalizeEncoding( string $input ): string;
Normalizes a string's encoding to UTF-32, used by the CSS and JS escapers before invoking the C-level escape routines.

public function setDoubleEncode( bool $doubleEncode );
public function setEncoding( string $encoding );
public function setFlags( int $flags );

Html\Escaper\AttributeEscaper

Source on GitHub

  • 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

public function __invoke( mixed $input = null ): string;
public function escape( mixed $input = null ): string;

protected function escapeValue( string $input ): string;
Encodes a single key/value via htmlspecialchars.

Html\Escaper\CssEscaper

Source on GitHub

  • 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

public function __invoke( string $input ): string;
public function escape( string $input ): string;

Html\Escaper\EscaperInterface Interface

Source on GitHub

  • Namespace

    • Phalcon\Html\Escaper
  • Uses

  • Extends

  • Implements

Interface for Phalcon\Html\Escaper

Methods

public function attributes( string $input ): string;
Escapes a HTML attribute string

public function css( string $input ): string;
Escape CSS strings by replacing non-alphanumeric chars by their hexadecimal representation

public function getEncoding(): string;
Returns the internal encoding used by the escaper

public function html( string $input ): string;
Escapes a HTML string

public function js( string $input ): string;
Escape Javascript strings by replacing non-alphanumeric chars by their hexadecimal representation

public function setEncoding( string $encoding ): EscaperInterface;
Sets the encoding to be used by the escaper

public function setFlags( int $flags ): EscaperInterface;
Sets the HTML quoting type for htmlspecialchars

public function url( string $input ): string;
Escapes a URL. Internally uses rawurlencode

Html\Escaper\Exception

Source on GitHub

  • Namespace

    • Phalcon\Html\Escaper
  • Uses

  • Extends

    \Exception

  • Implements

Exceptions thrown in Phalcon\Html\Escaper will use this class

Html\Escaper\HtmlEscaper

Source on GitHub

  • Namespace

    • Phalcon\Html\Escaper
  • Uses

  • Extends

    AbstractEscaper

  • Implements

Escapes a string for use as HTML body content via htmlspecialchars.

Methods

public function __invoke( string $input = null ): string;
public function escape( string $input = null ): string;

Html\Escaper\JsEscaper

Source on GitHub

  • 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

public function __invoke( string $input ): string;
public function escape( string $input ): string;

Html\Escaper\UrlEscaper

Source on GitHub

  • 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

public function __invoke( string $input ): string;
public function escape( string $input ): string;

Html\EscaperFactory

Source on GitHub

  • Namespace

    • Phalcon\Html
  • Uses

  • Extends

  • Implements

Class EscaperFactory

Methods

public function newInstance(): Escaper;
Create a new instance of the object

Html\Exception

Source on GitHub

  • Namespace

    • Phalcon\Html
  • Uses

  • Extends

    \Exception

  • Implements

Phalcon\Html\Tag\Exception

Exceptions thrown in Phalcon\Html\Tag will use this class

Html\Helper\AbstractHelper Abstract

Source on GitHub

  • Namespace

    • Phalcon\Html\Helper
  • Uses

    • Phalcon\Html\Escaper\EscaperInterface
    • Phalcon\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

public function __construct( EscaperInterface $escaper, Doctype $doctype = null );
AbstractHelper constructor.

protected function close( string $tag, bool $raw = bool ): string;
Produces a closing tag

protected function indent(): string;
Replicates the indent x times as per indentLevel

protected function injectAttribute( string $key, string $value, array $attributes ): array;
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.

protected function orderAttributes( array $overrides, array $attributes ): array;
Keeps all the attributes sorted - same order all the tome

protected function renderArrayElements( array $elements, string $delimiter ): string;
Traverses an array and calls the method defined in the first element with attributes as the second, returning the resulting string

protected function renderAttributes( array $attributes ): string;
Renders all the attributes

protected function renderElement( string $tag, array $attributes = [] ): string;
Renders an element

protected function renderFullElement( string $tag, string $text, array $attributes = [], bool $raw = bool ): string;
Renders an element

protected function renderTag( string $tag, array $attributes = [], string $close = string ): string;
Renders a tag

protected function selfClose( string $tag, array $attributes = [] ): string;
Produces a self close tag i.e.

Html\Helper\AbstractList Abstract

Source on GitHub

  • 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;

public function __toString();
Generates and returns the HTML for the list.

abstract protected function getTag(): string;
Returns the tag name.

Html\Helper\AbstractSeries Abstract

Source on GitHub

  • Namespace

    • Phalcon\Html\Helper
  • Uses

  • Extends

    AbstractHelper

  • Implements

@property array $attributes @property array $store

Properties

/**
 * @var array
 */
protected $attributes;

/**
 * @var array
 */
protected $store;

Methods

public function __invoke( string $indent = string, string $delimiter = null ): AbstractSeries;

public function __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.

public function reset(): AbstractSeries;
Resets the internal store.

abstract protected function getTag(): string;
Returns the tag name.

protected function pushOrPlace( array $entry, int $position = int ): void;
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

Source on GitHub

  • Namespace

    • Phalcon\Html\Helper
  • Uses

    • Phalcon\Html\Escaper\EscaperInterface
    • Phalcon\Html\Exception
  • Extends

    AbstractHelper

  • Implements

Class Anchor

@property bool $forceRaw

Properties

/**
 * @var bool
 */
protected $forceRaw = false;

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;
Produce a tag

Html\Helper\Base

Source on GitHub

  • Namespace

    • Phalcon\Html\Helper
  • Uses

    • Phalcon\Html\Exception
  • Extends

    AbstractHelper

  • Implements

Class Base

Methods

public function __invoke( string $href = null, array $attributes = [] ): string;
Produce a <base/> tag.

Html\Helper\Body

Source on GitHub

  • Namespace

    • Phalcon\Html\Helper
  • Uses

    • Phalcon\Html\Exception
  • Extends

    AbstractHelper

  • Implements

Class Body

Methods

public function __invoke( array $attributes = [] ): string;
Produce a <body> tag.

Html\Helper\Breadcrumbs

Source on GitHub

  • Namespace

    • Phalcon\Html\Helper
  • Uses

    • Phalcon\Html\Escaper\EscaperInterface
    • Phalcon\Mvc\Url\UrlInterface
    • Phalcon\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, icon: string, link: string, text: string }

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

public function __construct( EscaperInterface $escaper, UrlInterface $url = null );
AbstractHelper constructor.

public function __invoke( string $indent = string, string $delimiter = null ): Breadcrumbs;
Sets the indent and delimiter and returns the object back.

public function add( string $text, string $link = string, string $icon = string, array $attributes = [] ): Breadcrumbs;
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");

public function clear(): void;
Clears the crumbs.

$breadcrumbs->clear()

public function clearAttributes(): Breadcrumbs;
Clear the attributes of the parent element.

public function getAttributes(): array;
Get the attributes of the parent element.

public function getPrefix(): string;
Returns the link prefix.

public function getSeparator(): string;
Returns the separator.

public function getTemplate(): array;
Return the current template.

public function remove( int $index ): void;
Removes crumb by url.

// Remove the second element
$breadcrumbs->remove(2);

public function render(): string;
Renders and outputs breadcrumbs based on previously set template.

echo $breadcrumbs->render();

public function setAttributes( array $attributes ): Breadcrumbs;
Set the attributes for the parent element.

public function setPrefix( string $prefix ): Breadcrumbs;
Set the link prefix prepended to every non-empty link during rendering. When a Url service was injected, calling this method replaces it.

public function setSeparator( string $separator ): Breadcrumbs;
Set the separator.

public function setTemplate( string $main, string $line, string $last ): Breadcrumbs;
Set the HTML template.

public function toArray(): array;
Returns the internal breadcrumbs array.

Html\Helper\Button

Source on GitHub

  • Namespace

    • Phalcon\Html\Helper
  • Uses

    • Phalcon\Html\Escaper\EscaperInterface
    • Phalcon\Html\Exception
  • Extends

    AbstractHelper

  • Implements

Class Button

@property bool $forceRaw

Properties

/**
 * @var bool
 */
protected $forceRaw = false;

Methods

public function __construct( EscaperInterface $escaper, Doctype $doctype = null, bool $forceRaw = bool );

public function __invoke( string $text, array $attributes = [], bool $raw = bool ): string;
Produce a <button> tag.

Html\Helper\Close

Source on GitHub

  • Namespace

    • Phalcon\Html\Helper
  • Uses

  • Extends

    AbstractHelper

  • Implements

Class Close

Methods

public function __invoke( string $tag, bool $raw = bool ): string;
Produce a </...> tag.

Html\Helper\Doctype

Source on GitHub

  • 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

/**
 * @var string
 */
private $delimiter;

/**
 * @var int
 */
private $type;

Methods

public function __construct();

public function __invoke( int $type = static-constant-access, string $delimiter = string ): Doctype;
Produce a tag

public function __toString(): string;
public function getType(): int;

Html\Helper\Element

Source on GitHub

  • Namespace

    • Phalcon\Html\Helper
  • Uses

    • Phalcon\Html\Escaper\EscaperInterface
    • Phalcon\Html\Exception
  • Extends

    AbstractHelper

  • Implements

Class Element

@property bool $forceRaw

Properties

/**
 * @var bool
 */
protected $forceRaw = false;

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;
Produce a tag.

Html\Helper\Form

Source on GitHub

  • Namespace

    • Phalcon\Html\Helper
  • Uses

    • Phalcon\Html\Exception
  • Extends

    AbstractHelper

  • Implements

Class Form

Methods

public function __invoke( array $attributes = [] ): string;
Produce a <form> tag.

Html\Helper\FriendlyTitle

Source on GitHub

  • Namespace

    • Phalcon\Html\Helper
  • Uses

    • Phalcon\Html\Escaper\EscaperInterface
    • Phalcon\Html\Exception
    • Phalcon\Support\Helper\Str\Friendly
  • Extends

    AbstractHelper

  • Implements

Converts text to a URL-friendly slug.

Properties

/**
 * @var Friendly
 */
protected $friendly;

Methods

public function __construct( EscaperInterface $escaper );
public function __invoke( string $text, string $separator = string, bool $lowercase = bool, mixed $replace = null ): string;

Html\Helper\Img

Source on GitHub

  • Namespace

    • Phalcon\Html\Helper
  • Uses

    • Phalcon\Html\Exception
  • Extends

    AbstractHelper

  • Implements

Class Img

Methods

public function __invoke( string $src, array $attributes = [] ): string;
Produce a tag.

Html\Helper\Input\AbstractChecked Abstract

Source on GitHub

  • Namespace

    • Phalcon\Html\Helper\Input
  • Uses

    • Phalcon\Html\Escaper\EscaperInterface
    • Phalcon\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

/**
 * @var array
 */
protected $label;

/**
 * @var bool
 */
protected $strict = false;

Methods

public function __construct( EscaperInterface $escaper, Doctype $doctype = null );

public function __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.

public function label( array $attributes = [] ): AbstractChecked;
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.

public function strict( bool $flag = bool ): AbstractChecked;
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.

protected function processChecked(): void;
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)).

protected function processUnchecked(): string;
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

  • 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;

public function __toString(): string;
Renders the group of inputs as a string.

abstract protected function isChecked( string $value ): bool;
Determines whether the given value is considered checked.

protected function renderItem( string $value, mixed $definition ): string;
Renders a single input + optional label pair.

Html\Helper\Input\AbstractInput Abstract

Source on GitHub

  • Namespace

    • Phalcon\Html\Helper\Input
  • Uses

    • Phalcon\Html\Helper\AbstractHelper
    • Phalcon\Html\Helper\Doctype
  • Extends

    AbstractHelper

  • Implements

Class AbstractInput

@property array $attributes @property string $type @property string $value

Properties

/**
 * @var string
 */
protected $type = text;

/**
 * @var array
 */
protected $attributes;

Methods

public function __invoke( string $name, string $value = null, array $attributes = [] ): AbstractInput;

public function __toString();
Returns the HTML for the input.

public function setValue( string $value = null ): AbstractInput;
Sets the value of the element

Html\Helper\Input\Checkbox

Source on GitHub

  • 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

/**
 * @var string
 */
protected $type = checkbox;

Html\Helper\Input\CheckboxGroup

Source on GitHub

  • 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

/**
 * @var string
 */
protected $type = checkbox;

Methods

protected function isChecked( string $value ): bool;
Returns true when $value appears in the checked list.

Html\Helper\Input\Generic

Source on GitHub

  • Namespace

    • Phalcon\Html\Helper\Input
  • Uses

    • Phalcon\Html\Escaper\EscaperInterface
    • Phalcon\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 );

public function setType( string $type ): AbstractInput;
Sets the type of the input.

Html\Helper\Input\Radio

Source on GitHub

  • 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

/**
 * @var string
 */
protected $type = radio;

Html\Helper\Input\RadioGroup

Source on GitHub

  • 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

/**
 * @var string
 */
protected $type = radio;

Methods

protected function isChecked( string $value ): bool;
Returns true when $value loosely equals the checked scalar.

Html\Helper\Input\Select

Source on GitHub

  • Namespace

    • Phalcon\Html\Helper\Input
  • Uses

    • Phalcon\Contracts\Html\Helper\Input\SelectData
    • Phalcon\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;
Add an element to the list

public function addPlaceholder( string $text, mixed $value = null, array $attributes = [], bool $raw = bool ): Select;
Add a placeholder to the element

public function fromData( SelectData $data ): Select;
Populates the select from a data provider.

Flat entries: key = option value, value = label string. Optgroup entries: key = group label, value = [value => label] array.

public function optGroup( string $label = null, array $attributes = [] ): Select;
Creates an option group

public function placeholder( string $text ): Select;
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.

public function selected( string $selected ): Select;

public function strict( bool $flag = bool ): Select;
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.

protected function getTag(): string;
protected function optGroupEnd(): string;
protected function optGroupStart( string $label, array $attributes ): string;

Html\Helper\Input\Select\ArrayData

Source on GitHub

  • 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

/**
 * @var array
 */
protected $attributes;

/**
 * @var array
 */
protected $data;

Methods

public function __construct( array $data = [], array $attributes = [] );
public function getAttributes(): array;
public function getOptions(): array;

Html\Helper\Input\Select\ResultsetData

Source on GitHub

  • Namespace

    • Phalcon\Html\Helper\Input\Select
  • Uses

    • InvalidArgumentException
    • Phalcon\Contracts\Html\Helper\Input\SelectData
    • Phalcon\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 = [] );
public function getAttributes(): array;
public function getOptions(): array;

protected function readField( mixed $option, string $field );
Reads a property from the row, supporting both objects (via readAttribute when present) and plain arrays.

protected function resolve(): void;
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

Source on GitHub

  • Namespace

    • Phalcon\Html\Helper\Input
  • Uses

    • Phalcon\Html\Exception
  • Extends

    AbstractInput

  • Implements

Class Textarea

Properties

/**
 * @var string
 */
protected $type = textarea;

Methods

public function __toString();
Returns the HTML for the input.

Html\Helper\Label

Source on GitHub

  • Namespace

    • Phalcon\Html\Helper
  • Uses

    • Phalcon\Html\Escaper\EscaperInterface
    • Phalcon\Html\Exception
  • Extends

    AbstractHelper

  • Implements

Class Label

@property bool $forceRaw

Properties

/**
 * @var bool
 */
protected $forceRaw = false;

Methods

public function __construct( EscaperInterface $escaper, Doctype $doctype = null, bool $forceRaw = bool );

public function __invoke( string $label, array $attributes = [], bool $raw = bool ): string;
Produce a <label> tag.

Source on GitHub

  • Namespace

    • Phalcon\Html\Helper
  • Uses

  • Extends

    Style

  • Implements

Creates tags

Methods

public function add( string $url, array $attributes = [], int $position = int );
Add an element to the list

protected function getAttributes( string $url, array $attributes ): array;
Returns the necessary attributes

protected function getTag(): string;

Html\Helper\Meta

Source on GitHub

  • Namespace

    • Phalcon\Html\Helper
  • Uses

    • Phalcon\Html\Exception
  • Extends

    AbstractSeries

  • Implements

Class Meta

Methods

public function add( array $attributes = [], int $position = int ): Meta;
Add an element to the list

public function addHttp( string $httpEquiv, string $content, int $position = int ): Meta;
public function addName( string $name, string $content, int $position = int ): Meta;
public function addProperty( string $name, string $content, int $position = int ): Meta;
protected function getTag(): string;

Html\Helper\Ol

Source on GitHub

  • Namespace

    • Phalcon\Html\Helper
  • Uses

    • Phalcon\Html\Escaper\EscaperInterface
  • Extends

    AbstractList

  • Implements

Class Ol

@property bool $forceRaw

Properties

/**
 * @var bool
 */
protected $forceRaw = false;

Methods

public function __construct( EscaperInterface $escaper, Doctype $doctype = null, bool $forceRaw = bool );

public function add( string $text, array $attributes = [], bool $raw = bool ): AbstractList;
Add an element to the list

protected function getTag(): string;

Html\Helper\Preload

Source on GitHub

  • Namespace

    • Phalcon\Html\Helper
  • Uses

    • Phalcon\Html\Escaper\EscaperInterface
    • Phalcon\Html\Link\Link
    • Phalcon\Html\Link\Serializer\Header
    • Phalcon\Http\ResponseInterface
  • Extends

    AbstractHelper

  • Implements

Generates a tag for resource hinting. If a ResponseInterface is provided, also sets the HTTP Link header.

Properties

/**
 * @var ResponseInterface|null
 */
protected $response;

Methods

public function __construct( EscaperInterface $escaper, ResponseInterface $response = null );
public function __invoke( string $href, string $type = string, array $attributes = [] ): string;

Html\Helper\Script

Source on GitHub

  • Namespace

    • Phalcon\Html\Helper
  • Uses

    • Phalcon\Html\Exception
  • Extends

    AbstractSeries

  • Implements

Class Script

Methods

public function add( string $url, array $attributes = [], int $position = int );
Add an element to the list

public function beginInternal(): void;
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.

public function endInternal( array $attributes = [], int $position = int ): Script;
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).

protected function getAttributes( string $url, array $attributes ): array;
Returns the necessary attributes

protected function getTag(): string;

Html\Helper\Style

Source on GitHub

  • Namespace

    • Phalcon\Html\Helper
  • Uses

    • Phalcon\Html\Exception
  • Extends

    AbstractSeries

  • Implements

Class Style

Properties

/**
 * @var bool
 */
private $isStyle = false;

Methods

public function add( string $url, array $attributes = [], int $position = int );
Add an element to the list

public function setStyle( bool $flag ): Style;
Sets if this is a style or link tag

protected function getAttributes( string $url, array $attributes ): array;
Returns the necessary attributes

protected function getTag(): string;

Html\Helper\Tag

Source on GitHub

  • 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

public function __invoke( string $name, array $attributes = [] ): string;

Html\Helper\Title

Source on GitHub

  • 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

public function __invoke( string $indent = string, string $delimiter = null ): Title;
Sets the separator and returns the object back

public function __toString();
Returns the title tags

public function append( string $text, bool $raw = bool ): Title;
Appends text to current document title

public function get(): string;
Returns the title

public function prepend( string $text, bool $raw = bool ): Title;
Prepends text to current document title

public function set( string $text, bool $raw = bool ): Title;
Sets the title

public function setSeparator( string $separator, bool $raw = bool ): Title;
Sets the separator

Html\Helper\Ul

Source on GitHub

  • Namespace

    • Phalcon\Html\Helper
  • Uses

  • Extends

    Ol

  • Implements

Class Ul

Methods

protected function getTag(): string;

Html\Helper\VoidTag

Source on GitHub

  • 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

public function __invoke( string $name, array $attributes = [] ): string;

Source on GitHub

  • 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

public function __construct( string $rel = string, string $href = string, array $attributes = [] );
Link constructor.

protected function doGetAttributes(): array;
Returns a list of attributes that describe the target URI.

protected function doGetHref(): string;
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.

protected function doGetRels(): array;
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.

protected function doIsTemplated(): bool;
Returns whether this is a templated link.

protected function doWithAttribute( string $key, mixed $value );
protected function doWithHref( string $href );
protected function doWithRel( string $key );
protected function doWithoutAttribute( string $key );
protected function doWithoutRel( string $key );

protected function hrefIsTemplated( string $href ): bool;
Determines if a href is a templated link or not.

@see https://tools.ietf.org/html/rfc6570

Html\Link\AbstractLinkProvider Abstract

Source on GitHub

  • Namespace

    • Phalcon\Html\Link
  • Uses

    • Phalcon\Html\Link\Interfaces\LinkInterface
  • Extends

  • Implements

@property array $links

Properties

/**
 * @var array
 */
protected $links;

Methods

public function __construct( array $links = [] );
LinkProvider constructor.

protected function doGetLinks(): array;
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.

protected function doGetLinksByRel( string $rel ): array;
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.

protected function doWithLink( mixed $link );
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.

protected function doWithoutLink( mixed $link );
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.

protected function getKey( mixed $link ): string;
Returns the object hash key

Source on GitHub

  • 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

public function withAttribute( mixed $attribute, mixed $value ): EvolvableLinkInterface;
Returns an instance with the specified attribute added.

If the specified attribute is already present, it will be overwritten with the new value.

public function withHref( string $href ): EvolvableLinkInterface;
Returns an instance with the specified href.

public function withRel( string $rel ): EvolvableLinkInterface;
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.

public function withoutAttribute( string $attribute ): EvolvableLinkInterface;
Returns an instance with the specified attribute excluded.

If the specified attribute is not present, this method MUST return normally without errors.

public function withoutRel( string $rel ): EvolvableLinkInterface;
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

Source on GitHub

  • Namespace

    • Phalcon\Html\Link
  • Uses

    • Phalcon\Html\Link\Interfaces\EvolvableLinkProviderInterface
    • Phalcon\Html\Link\Interfaces\LinkInterface
  • Extends

    LinkProvider

  • Implements

    • EvolvableLinkProviderInterface

Class Phalcon\Http\Link\LinkProvider

@property LinkInterface[] links

Methods

public function withLink( LinkInterface $link ): EvolvableLinkProviderInterface;
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.

public function withoutLink( LinkInterface $link ): EvolvableLinkProviderInterface;
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

  • Namespace

    • Phalcon\Html\Link\Interfaces
  • Uses

  • Extends

    LinkInterface

  • Implements

An evolvable link value object.

Methods

public function withAttribute( string $attribute, string $value ): EvolvableLinkInterface;
Returns an instance with the specified attribute added.

If the specified attribute is already present, it will be overwritten with the new value.

public function withHref( string $href ): EvolvableLinkInterface;
Returns an instance with the specified href.

public function withRel( string $rel ): EvolvableLinkInterface;
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.

public function withoutAttribute( string $attribute ): EvolvableLinkInterface;
Returns an instance with the specified attribute excluded.

If the specified attribute is not present, this method MUST return normally without errors.

public function withoutRel( string $rel ): EvolvableLinkInterface;
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

  • Namespace

    • Phalcon\Html\Link\Interfaces
  • Uses

  • Extends

    LinkProviderInterface

  • Implements

An evolvable link provider value object.

Methods

public function withLink( LinkInterface $link ): EvolvableLinkProviderInterface;
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.

public function withoutLink( LinkInterface $link ): EvolvableLinkProviderInterface;
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 Interface

Source on GitHub

  • Namespace

    • Phalcon\Html\Link\Interfaces
  • Uses

  • Extends

  • Implements

A readable link object.

Methods

public function getAttributes(): array;
Returns a list of attributes that describe the target URI.

public function getHref(): string;
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.

public function getRels(): array;
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.

public function isTemplated(): bool;
Returns whether this is a templated link.

Html\Link\Interfaces\LinkProviderInterface Interface

Source on GitHub

  • Namespace

    • Phalcon\Html\Link\Interfaces
  • Uses

  • Extends

  • Implements

A link provider object.

Methods

public function getLinks(): array;
Returns an array of LinkInterface objects.

public function getLinksByRel( string $rel ): array;
Returns an array of LinkInterface objects that have a specific relationship.

Source on GitHub

  • Namespace

    • Phalcon\Html\Link
  • Uses

    • Phalcon\Html\Link\Interfaces\LinkInterface
    • Phalcon\Support\Collection
    • Phalcon\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

public function getAttributes(): array;
Returns a list of attributes that describe the target URI.

public function getHref(): string;
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.

public function getRels(): array;
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.

public function isTemplated(): bool;
Returns whether or not this is a templated link.

Html\Link\LinkProvider

Source on GitHub

  • Namespace

    • Phalcon\Html\Link
  • Uses

    • Phalcon\Html\Link\Interfaces\LinkInterface
    • Phalcon\Html\Link\Interfaces\LinkProviderInterface
  • Extends

    AbstractLinkProvider

  • Implements

    • LinkProviderInterface

@property LinkInterface[] links

Methods

public function getLinks(): array;
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.

public function getLinksByRel( mixed $rel ): array;
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

Source on GitHub

  • Namespace

    • Phalcon\Html\Link\Serializer
  • Uses

  • Extends

  • Implements

    • SerializerInterface

Class Phalcon\Http\Link\Serializer\Header

Methods

public function serialize( array $links ): string | null;
Serializes all the passed links to a HTTP link header

Html\Link\Serializer\SerializerInterface Interface

Source on GitHub

  • Namespace

    • Phalcon\Html\Link\Serializer
  • Uses

  • Extends

  • Implements

Class Phalcon\Http\Link\Serializer\SerializerInterface

Methods

public function serialize( array $links ): string | null;
Serializer method

Html\TagFactory

Source on GitHub

  • Namespace

    • Phalcon\Html
  • Uses

    • Closure
    • Phalcon\Html\Escaper\EscaperInterface
    • 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
  • 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

public function __call( string $name, array $arguments );
Magic call to make the helper objects available as methods.

public function __construct( EscaperInterface $escaper, array $services = [], ResponseInterface $response = null, UrlInterface $url = null );
TagFactory constructor.

@phpstan-param array $services

public function has( string $name ): bool;

public function newInstance( string $name ): object;
Create or return a cached instance of the helper.

public function set( string $name, Closure $definition ): void;
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.

protected function getDefaultServices(): array;
Default service recipes. Every entry is a Closure that returns a fully-constructed helper instance. Services are built lazily and cached.