Phalcon html
NOTE
All classes are prefixed with Phalcon
Html\Attributes¶
Class Source on GitHub
This class helps to work with HTML Attributes
Phalcon\Support\CollectionPhalcon\Html\Attributes- implementsPhalcon\Html\Attributes\RenderInterface
Uses Phalcon\Html\Attributes\RenderInterface · Phalcon\Html\Escaper\AttributeEscaper · Phalcon\Html\Exceptions\AttributeNotRenderable · Phalcon\Support\Collection
Method Summary¶
public
string
__toString()
Alias of the render method
public
string
render()
Render attributes as HTML attributes
protected
string
renderAttributes( array $attributes )
@todo remove this when we refactor forms. Maybe remove this class? Put it into traits
Methods¶
__toString()¶
Alias of the render method
render()¶
Render attributes as HTML attributes
renderAttributes()¶
@todo remove this when we refactor forms. Maybe remove this class? Put it into traits
Html\Attributes\AttributesInterface¶
Interface Source on GitHub
Html Attributes Interface
Phalcon\Html\Attributes\AttributesInterface
Uses Phalcon\Html\Attributes
Method Summary¶
public
Attributes
getAttributes()
Get Attributes
public
AttributesInterface
setAttributes( Attributes $attributes )
Set Attributes
Methods¶
getAttributes()¶
Get Attributes
setAttributes()¶
Set Attributes
Html\Attributes\RenderInterface¶
Interface Source on GitHub
Rendering interface for HTML attributes
Phalcon\Html\Attributes\RenderInterface
Method Summary¶
Methods¶
render()¶
Generate a string representation
Html\Breadcrumbs¶
Class Source on GitHub
Phalcon\Html\Breadcrumbs
This component offers an easy way to create breadcrumbs for your application.
The resulting HTML when calling render() will have each breadcrumb enclosed
in <dt> tags, while the whole string is enclosed in <dl> tags.
@property array $elements @property string $separator @property string $template
Phalcon\Html\Breadcrumbs
Method Summary¶
public
static
add(string $label,string $link = "")
Adds a new crumb.
public
void
clear()
Clears the crumbs
public
string
getSeparator()
Returns the separator
public
void
remove( string $link )
Removes crumb by url.
public
string
render()
Renders and outputs breadcrumbs based on previously set template.
public
static
setSeparator( string $separator )
Set the separator
public
array
toArray()
Returns the internal breadcrumbs array
Methods¶
add()¶
Adds a new crumb.
// Adding a crumb with a link
$breadcrumbs->add("Home", "/");
// Adding a crumb without a link (normally the last one)
$breadcrumbs->add("Users");
Crumbs are stored keyed by their link, so adding two crumbs that share the same link - including two link-less crumbs, which share the empty string key - keeps only the last one.
clear()¶
Clears the crumbs
getSeparator()¶
Returns the separator
remove()¶
Removes crumb by url.
$breadcrumbs->remove("/admin/user/create");
// remove a crumb without an url (last link)
$breadcrumbs->remove();
render()¶
Renders and outputs breadcrumbs based on previously set template.
setSeparator()¶
Set the separator
toArray()¶
Returns the internal breadcrumbs array
Html\Escaper¶
Class Source on GitHub
Phalcon\Html\Escaper
Escapes different kinds of text securing them. By using this component you may prevent XSS attacks.
The class is a façade over five per-context escapers (HtmlEscaper,
AttributeEscaper, CssEscaper, JsEscaper, UrlEscaper). Each can be
retrieved via the matching getXxxEscaper() accessor and substituted via
the matching setXxxEscaper() setter. The legacy setEncoding,
setFlags, and setDoubleEncode continue to fan out to all sub-objects
so existing code keeps working.
This component only works with UTF-8. The PREG extension needs to be compiled with UTF-8 support.
$escaper = new \Phalcon\Html\Escaper();
$escaped = $escaper->css("font-family: <Verdana>");
echo $escaped; // font\2D family\3A \20 \3C Verdana\3E
@property AttributeEscaper $attributeEscaper @property CssEscaper $cssEscaper @property HtmlEscaper $htmlEscaper @property JsEscaper $jsEscaper @property UrlEscaper $urlEscaper
Phalcon\Html\Escaper- implementsPhalcon\Html\Escaper\EscaperInterface
Uses Phalcon\Html\Escaper\AttributeEscaper · Phalcon\Html\Escaper\CssEscaper · Phalcon\Html\Escaper\EscaperInterface · Phalcon\Html\Escaper\HtmlEscaper · Phalcon\Html\Escaper\JsEscaper · Phalcon\Html\Escaper\UrlEscaper
Method Summary¶
public
__construct(string $encoding = "utf-8",int $flags,bool $doubleEncode = true)
Constructor. Accepts the legacy scalar params for backward compatibility
public
string
attributes( mixed $input = null )
Escapes a HTML attribute string or array. Delegates to AttributeEscaper.
public
string
css( string $input )
Escape CSS strings. Delegates to CssEscaper.
public
string|null
detectEncoding( string $input )
Detects the character encoding of a string. Delegates to HtmlEscaper.
public
string
escapeCss( string $input )
public
string
escapeHtml( string|null $input = null )
public
string
escapeHtmlAttr( string|null $input = null )
public
string
escapeJs( string $input )
public
string
escapeUrl( string $input )
public
AttributeEscaper
getAttributeEscaper()
public
CssEscaper
getCssEscaper()
public
string
getEncoding()
Returns the encoding from the HtmlEscaper.
public
int
getFlags()
Returns the flags from the HtmlEscaper.
public
HtmlEscaper
getHtmlEscaper()
public
JsEscaper
getJsEscaper()
public
UrlEscaper
getUrlEscaper()
public
string
html( string|null $input = null )
Escapes a HTML string. Delegates to HtmlEscaper.
public
string
js( string $input )
Escape javascript strings. Delegates to JsEscaper.
public
string
normalizeEncoding( string $input )
Normalizes a string's encoding to UTF-32. Delegates to HtmlEscaper.
public
static
setAttributeEscaper( AttributeEscaper $escaper )
public
static
setCssEscaper( CssEscaper $escaper )
public
static
setDoubleEncode( bool $doubleEncode )
Sets the double_encode flag. Fans out to all sub-escapers.
public
static
setEncoding( string $encoding )
Sets the encoding. Fans out to all sub-escapers.
public
static
setFlags( int $flags )
Sets the htmlspecialchars flags. Fans out to all sub-escapers.
public
static
setHtmlEscaper( HtmlEscaper $escaper )
public
static
setHtmlQuoteType( int $flags )
Sets the HTML quoting type for htmlspecialchars.
public
static
setJsEscaper( JsEscaper $escaper )
public
static
setUrlEscaper( UrlEscaper $escaper )
public
string
url( string $input )
Escapes a URL. Delegates to UrlEscaper.
Properties¶
protected
AttributeEscaper
$attributeEscaper
protected
CssEscaper
$cssEscaper
protected
HtmlEscaper
$htmlEscaper
protected
JsEscaper
$jsEscaper
protected
UrlEscaper
$urlEscaper
Methods¶
__construct()¶
Constructor. Accepts the legacy scalar params for backward compatibility and fans them out to every sub-escaper so existing code keeps working.
attributes()¶
Escapes a HTML attribute string or array. Delegates to AttributeEscaper.
css()¶
Escape CSS strings. Delegates to CssEscaper.
detectEncoding()¶
Detects the character encoding of a string. Delegates to HtmlEscaper.
escapeCss()¶
escapeHtml()¶
escapeHtmlAttr()¶
escapeJs()¶
escapeUrl()¶
getAttributeEscaper()¶
getCssEscaper()¶
getEncoding()¶
Returns the encoding from the HtmlEscaper.
getFlags()¶
Returns the flags from the HtmlEscaper.
getHtmlEscaper()¶
getJsEscaper()¶
getUrlEscaper()¶
html()¶
Escapes a HTML string. Delegates to HtmlEscaper.
js()¶
Escape javascript strings. Delegates to JsEscaper.
normalizeEncoding()¶
Normalizes a string's encoding to UTF-32. Delegates to HtmlEscaper.
setAttributeEscaper()¶
setCssEscaper()¶
setDoubleEncode()¶
Sets the double_encode flag. Fans out to all sub-escapers.
setEncoding()¶
Sets the encoding. Fans out to all sub-escapers.
setFlags()¶
Sets the htmlspecialchars flags. Fans out to all sub-escapers.
setHtmlEscaper()¶
setHtmlQuoteType()¶
Sets the HTML quoting type for htmlspecialchars.
setJsEscaper()¶
setUrlEscaper()¶
url()¶
Escapes a URL. Delegates to UrlEscaper.
Html\EscaperFactory¶
Class Source on GitHub
Class EscaperFactory
Phalcon\Html\EscaperFactory
Method Summary¶
Methods¶
newInstance()¶
Create a new instance of the object
Html\Escaper\AbstractEscaper¶
Abstract Source on GitHub
Shared base for the per-context escaper objects. Holds the encoding, htmlspecialchars flag, and double-encode toggle, plus the encoding detection / normalization utilities used by the CSS and JS escapers.
Each concrete context (HtmlEscaper, AttributeEscaper, CssEscaper,
JsEscaper, UrlEscaper) extends this so that callers can configure
one context without affecting the others.
@property bool $doubleEncode @property string $encoding @property int $flags
Phalcon\Html\Escaper\AbstractEscaper
Uses Phalcon\Html\Escaper\Traits\EscaperTrait
Method Summary¶
Methods¶
escapeMulti()¶
protected function escapeMulti(
string $input,
string $escapeChar,
string $escapeExtra,
bool $whitelist
): string;
Perform escaping of non-alphanumeric characters to different formats.
Html\Escaper\AttributeEscaper¶
Class Source on GitHub
Escapes either a single attribute value (string) or an associative array
of attribute pairs. Boolean true becomes a bare key (e.g. disabled);
false and null skip the entry; arrays are joined with a space.
Phalcon\Html\Escaper\AbstractEscaperPhalcon\Html\Escaper\AttributeEscaper
Method Summary¶
public
string
__invoke( mixed $input = null )
public
string
escape( mixed $input = null )
protected
string
escapeValue( string $input )
Encodes a single key/value via htmlspecialchars.
Methods¶
__invoke()¶
escape()¶
escapeValue()¶
Encodes a single key/value via htmlspecialchars.
Html\Escaper\CssEscaper¶
Class Source on GitHub
Escapes a string for use inside a CSS value by replacing non-alphanumeric characters with their hexadecimal escape sequence.
Phalcon\Html\Escaper\AbstractEscaperPhalcon\Html\Escaper\CssEscaper
Method Summary¶
Methods¶
__invoke()¶
escape()¶
Html\Escaper\EscaperInterface¶
Interface Source on GitHub
Interface for Phalcon\Html\Escaper.
This declares the stable context-escaping surface. The concrete
{@see \Phalcon\Html\Escaper} facade also exposes members that are not part
of this contract - setDoubleEncode(), getFlags(), and the per-context
sub-escaper getters/setters (getHtmlEscaper(), setAttributeEscaper(),
and the rest). Type against the concrete class to reach those.
Phalcon\Html\Escaper\EscaperInterface
Method Summary¶
public
string
attributes( string $input )
Escapes a HTML attribute string.
public
string
css( string $input )
Escape CSS strings by replacing non-alphanumeric chars by their
public
string
getEncoding()
Returns the internal encoding used by the escaper
public
string
html( string $input )
Escapes a HTML string.
public
string
js( string $input )
Escape Javascript strings by replacing non-alphanumeric chars by their
public
EscaperInterface
setEncoding( string $encoding )
Sets the encoding to be used by the escaper
public
EscaperInterface
setFlags( int $flags )
Sets the HTML quoting type for htmlspecialchars
public
string
url( string $input )
Escapes a URL. Internally uses rawurlencode
Methods¶
attributes()¶
Escapes a HTML attribute string.
The concrete {@see \Phalcon\Html\Escaper} also accepts an array of
attribute pairs and tolerates null: an array is rendered as escaped
key="value" pairs, null and false values are skipped, and true
renders as a bare key. Callers typed against this interface pass a
string. The widened signature lands in the next major.
css()¶
Escape CSS strings by replacing non-alphanumeric chars by their hexadecimal representation
getEncoding()¶
Returns the internal encoding used by the escaper
html()¶
Escapes a HTML string.
The concrete {@see \Phalcon\Html\Escaper} tolerates null, returning an
empty string for it. The nullable signature lands in the next major.
js()¶
Escape Javascript strings by replacing non-alphanumeric chars by their hexadecimal representation
setEncoding()¶
Sets the encoding to be used by the escaper
setFlags()¶
Sets the HTML quoting type for htmlspecialchars
url()¶
Escapes a URL. Internally uses rawurlencode
Html\Escaper\Exception¶
Class Source on GitHub
Class Exception
\ExceptionPhalcon\Html\Escaper\Exception
Html\Escaper\HtmlEscaper¶
Class Source on GitHub
Escapes a string for use as HTML body content via htmlspecialchars.
Phalcon\Html\Escaper\AbstractEscaperPhalcon\Html\Escaper\HtmlEscaper
Method Summary¶
public
string
__invoke( string|null $input = null )
public
string
escape( string|null $input = null )
Methods¶
__invoke()¶
escape()¶
Html\Escaper\JsEscaper¶
Class Source on GitHub
Escapes a string for use inside a JavaScript context by replacing non-alphanumeric characters with their hexadecimal escape sequence.
Phalcon\Html\Escaper\AbstractEscaperPhalcon\Html\Escaper\JsEscaper
Method Summary¶
Methods¶
__invoke()¶
escape()¶
Html\Escaper\Traits\EscaperTrait¶
Trait Source on GitHub
Shared encoding/flags state and the encoding detection/normalization
utilities used by the per-context escaper objects (HtmlEscaper,
AttributeEscaper, CssEscaper, JsEscaper, UrlEscaper).
@property bool $doubleEncode @property string $encoding @property int $flags
Phalcon\Html\Escaper\Traits\EscaperTrait
Used by Phalcon\Html\Escaper\AbstractEscaper
Method Summary¶
public
string|null
detectEncoding( string $input )
Detects the character encoding of a string. Special-handling for
public
bool
getDoubleEncode()
public
string
getEncoding()
public
int
getFlags()
public
string
normalizeEncoding( string $input )
Normalizes a string's encoding to UTF-32, used by the CSS and JS
public
static
setDoubleEncode( bool $doubleEncode )
public
static
setEncoding( string $encoding )
public
static
setFlags( int $flags )
Properties¶
protected
bool
$doubleEncode = true
protected
string
$encoding = "utf-8"
protected
int
$flags
ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401
Methods¶
detectEncoding()¶
Detects the character encoding of a string. Special-handling for
chr(172) and chr(128) to chr(159) which fail to be detected by
mb_detect_encoding().
getDoubleEncode()¶
getEncoding()¶
getFlags()¶
normalizeEncoding()¶
Normalizes a string's encoding to UTF-32, used by the CSS and JS escapers before invoking the escape routines.
setDoubleEncode()¶
setEncoding()¶
setFlags()¶
Html\Escaper\UrlEscaper¶
Class Source on GitHub
Escapes a string for use as a URL component via rawurlencode.
Phalcon\Html\Escaper\AbstractEscaperPhalcon\Html\Escaper\UrlEscaper
Uses Phalcon\Traits\Php\UrlTrait
Method Summary¶
Methods¶
__invoke()¶
escape()¶
Html\Exception¶
Class Source on GitHub
Class Exception
\Exception
Html\Exceptions\AttributeNotRenderable¶
Class Source on GitHub
\ExceptionPhalcon\Html\ExceptionPhalcon\Html\Exceptions\AttributeNotRenderable
Uses Phalcon\Html\Exception
Method Summary¶
Methods¶
__construct()¶
Html\Exceptions\FriendlyTitleConversionFailed¶
Class Source on GitHub
\ExceptionPhalcon\Html\ExceptionPhalcon\Html\Exceptions\FriendlyTitleConversionFailed
Uses Phalcon\Html\Exception
Method Summary¶
Methods¶
__construct()¶
Html\Exceptions\InvalidResultsetValue¶
Class Source on GitHub
\InvalidArgumentExceptionPhalcon\Html\Exceptions\InvalidResultsetValue
Uses InvalidArgumentException
Method Summary¶
Methods¶
__construct()¶
Html\Exceptions\ServiceNotRegistered¶
Class Source on GitHub
\ExceptionPhalcon\Html\ExceptionPhalcon\Html\Exceptions\ServiceNotRegistered
Uses Phalcon\Html\Exception
Method Summary¶
Methods¶
__construct()¶
Html\Exceptions\UsingRequiresTwoValues¶
Class Source on GitHub
\InvalidArgumentExceptionPhalcon\Html\Exceptions\UsingRequiresTwoValues
Uses InvalidArgumentException
Method Summary¶
Methods¶
__construct()¶
Html\Helper\AbstractHelper¶
Abstract Source on GitHub
@property string $delimiter @property EscaperInterface $escaper @property string $indent @property int $indentLevel
Phalcon\Html\Helper\AbstractHelperPhalcon\Html\Helper\AbstractListPhalcon\Html\Helper\AbstractSeriesPhalcon\Html\Helper\AnchorPhalcon\Html\Helper\BasePhalcon\Html\Helper\BodyPhalcon\Html\Helper\BreadcrumbsPhalcon\Html\Helper\ButtonPhalcon\Html\Helper\ClosePhalcon\Html\Helper\ElementPhalcon\Html\Helper\FormPhalcon\Html\Helper\FriendlyTitlePhalcon\Html\Helper\ImgPhalcon\Html\Helper\Input\AbstractGroupPhalcon\Html\Helper\Input\AbstractInputPhalcon\Html\Helper\LabelPhalcon\Html\Helper\PreloadPhalcon\Html\Helper\TagPhalcon\Html\Helper\TitlePhalcon\Html\Helper\VoidTag
Uses Phalcon\Html\Escaper\EscaperInterface
Method Summary¶
public
__construct(EscaperInterface $escaper,Doctype|null $doctype = null)
AbstractHelper constructor.
protected
string
close(string $tag,bool $raw = false)
Produces a closing tag
protected
string
indent()
Replicates the indent x times as per indentLevel
protected
array
injectAttribute(string $key,string $value,array $attributes)
Forces $key => $value to the front of the attributes array,
protected
array
orderAttributes(array $overrides,array $attributes)
Keeps all the attributes sorted - same order all the time
protected
string
renderArrayElements(array $elements,string $delimiter)
Traverses an array and calls the method defined in the first element
protected
string
renderAttributes( array $attributes )
Renders all the attributes
protected
string
renderElement(string $tag,array $attributes = [])
Renders an element
protected
string
renderFullElement(string $tag,string $text,array $attributes = [],bool $raw = false)
Renders an element
protected
string
renderTag(string $tag,array $attributes = [],string $close = "")
Renders a tag
protected
string
selfClose(string $tag,array $attributes = [])
Produces a self close tag i.e. <img />
Properties¶
protected
string
$delimiter = PHP_EOL
protected
Doctype|null
$doctype = null
protected
EscaperInterface
$escaper
protected
string
$indent = " "
protected
int
$indentLevel = 1
Methods¶
__construct()¶
AbstractHelper constructor.
close()¶
Produces a closing tag
indent()¶
Replicates the indent x times as per indentLevel
injectAttribute()¶
Forces $key => $value to the front of the attributes array,
removing any existing entry for that key. This guarantees the
attribute is always present and appears first in the rendered output.
orderAttributes()¶
Keeps all the attributes sorted - same order all the time
renderArrayElements()¶
Traverses an array and calls the method defined in the first element with attributes as the second, returning the resulting string
renderAttributes()¶
Renders all the attributes
renderElement()¶
Renders an element
renderFullElement()¶
protected function renderFullElement(
string $tag,
string $text,
array $attributes = [],
bool $raw = false
): string;
Renders an element
renderTag()¶
Renders a tag
selfClose()¶
Produces a self close tag i.e.
Html\Helper\AbstractList¶
Abstract Source on GitHub
Class AbstractList
Phalcon\Html\Helper\AbstractHelperPhalcon\Html\Helper\AbstractList
Method Summary¶
public
static
__invoke(string $indent = " ",string|null $delimiter = null,array $attributes = [])
public
__toString()
Generates and returns the HTML for the list.
protected
getTag()
Returns the tag name.
Properties¶
protected
array
$attributes = []
protected
string
$elementTag = "li"
protected
array
$store = []
Methods¶
__invoke()¶
public function __invoke(
string $indent = " ",
string|null $delimiter = null,
array $attributes = []
): static;
__toString()¶
Generates and returns the HTML for the list.
getTag()¶
Returns the tag name.
Html\Helper\AbstractSeries¶
Abstract Source on GitHub
@property array $attributes @property array $store
Phalcon\Html\Helper\AbstractHelperPhalcon\Html\Helper\AbstractSeries
Method Summary¶
public
static
__invoke(string $indent = " ",string|null $delimiter = null)
public
__toString()
Generates and returns the HTML for the list. Entries are sorted by
public
static
reset()
Resets the internal store.
protected
string
getTag()
Returns the tag name.
protected
void
pushOrPlace(array $entry,int $pos = -1)
Appends an entry to the store, optionally at a specific integer
Properties¶
protected
array
$attributes = []
protected
array
$store = []
Methods¶
__invoke()¶
__toString()¶
Generates and returns the HTML for the list. Entries are sorted by their integer key first, so an asset registered with a lower position renders before one registered with a higher position regardless of registration order.
reset()¶
Resets the internal store.
getTag()¶
Returns the tag name.
pushOrPlace()¶
Appends an entry to the store, optionally at a specific integer
position. When $pos is negative the entry is pushed onto the next
available auto-increment slot. When $pos is non-negative the entry
is placed at that key, advancing past any already-occupied slots so
existing entries are not overwritten. The store is ksort()ed in
__toString, so positions act as a sort key, not a strict address.
Html\Helper\Anchor¶
Class Source on GitHub
Class Anchor
@property bool $forceRaw
Phalcon\Html\Helper\AbstractHelperPhalcon\Html\Helper\Anchor
Uses Phalcon\Html\Escaper\EscaperInterface
Method Summary¶
public
__construct(EscaperInterface $escaper,Doctype|null $doctype = null,bool $forceRaw = false)
public
string
__invoke(string $href,string $text,array $attributes = [],bool $raw = false)
Produce a <a> tag
Properties¶
protected
bool
$forceRaw = false
Methods¶
__construct()¶
public function __construct(
EscaperInterface $escaper,
Doctype|null $doctype = null,
bool $forceRaw = false
);
__invoke()¶
public function __invoke(
string $href,
string $text,
array $attributes = [],
bool $raw = false
): string;
Produce a tag
Html\Helper\Base¶
Class Source on GitHub
Class Base
Phalcon\Html\Helper\AbstractHelperPhalcon\Html\Helper\Base
Method Summary¶
Methods¶
__invoke()¶
Produce a <base/> tag.
Html\Helper\Body¶
Class Source on GitHub
Class Body
Phalcon\Html\Helper\AbstractHelperPhalcon\Html\Helper\Body
Method Summary¶
Methods¶
__invoke()¶
Produce a <body> tag.
Html\Helper\Breadcrumbs¶
Class Source on GitHub
This component offers an easy way to create breadcrumbs for your application.
The resulting HTML when calling render() will have each breadcrumb enclosed
in <li> tags, while the whole string is enclosed in <nav> and <ol> tags.
Phalcon\Html\Helper\AbstractHelperPhalcon\Html\Helper\Breadcrumbs
Uses Phalcon\Html\Escaper\EscaperInterface · Phalcon\Mvc\Url\UrlInterface · Phalcon\Traits\Support\Helper\Str\InterpolateTrait
Method Summary¶
public
__construct(EscaperInterface $escaper,UrlInterface|null $url = null)
AbstractHelper constructor.
public
static
__invoke(string $indent = " ",string|null $delimiter = null)
Sets the indent and delimiter and returns the object back
public
static
add(string $text,string $link = "",string $icon = "",array $attributes = [])
Adds a new crumb.
public
void
clear()
Clears the crumbs
public
static
clearAttributes()
Clear the attributes of the parent element
public
array
getAttributes()
Get the attributes of the parent element
public
string
getPrefix()
Returns the link prefix.
public
string
getSeparator()
Returns the separator
public
array
getTemplate()
Return the current template
public
void
remove( int $index )
Removes crumb by url.
public
string
render()
Renders and outputs breadcrumbs based on previously set template.
public
static
setAttributes( array $attributes )
Set the attributes for the parent element
public
static
setPrefix( string $prefix )
Set the link prefix prepended to every non-empty link during rendering.
public
static
setSeparator( string $separator )
Set the separator
public
static
setTemplate(string $main,string $line,string $last)
Set the HTML template
public
array
toArray()
Returns the internal breadcrumbs array
Properties¶
protected
string
$delimiter = PHP_EOL
protected
string
$indent = " "
Methods¶
__construct()¶
AbstractHelper constructor.
__invoke()¶
Sets the indent and delimiter and returns the object back
add()¶
public function add(
string $text,
string $link = "",
string $icon = "",
array $attributes = []
): static;
Adds a new crumb.
// Adding a crumb with a link
$breadcrumbs->add("Home", "/");
// Adding a crumb with added attributes
$breadcrumbs->add("Home", "/", ["class" => "main"]);
// Adding a crumb without a link (normally the last one)
$breadcrumbs->add("Users");
clear()¶
Clears the crumbs
clearAttributes()¶
Clear the attributes of the parent element
getAttributes()¶
Get the attributes of the parent element
getPrefix()¶
Returns the link prefix.
getSeparator()¶
Returns the separator
getTemplate()¶
Return the current template
remove()¶
Removes crumb by url.
render()¶
Renders and outputs breadcrumbs based on previously set template.
setAttributes()¶
Set the attributes for the parent element
setPrefix()¶
Set the link prefix prepended to every non-empty link during rendering. When a Url service was injected, calling this method replaces it.
setSeparator()¶
Set the separator
setTemplate()¶
Set the HTML template
toArray()¶
Returns the internal breadcrumbs array
Html\Helper\Button¶
Class Source on GitHub
Class Button
@property bool $forceRaw
Phalcon\Html\Helper\AbstractHelperPhalcon\Html\Helper\Button
Uses Phalcon\Html\Escaper\EscaperInterface
Method Summary¶
public
__construct(EscaperInterface $escaper,Doctype|null $doctype = null,bool $forceRaw = false)
public
string
__invoke(string $text,array $attributes = [],bool $raw = false)
Produce a <button> tag.
Properties¶
protected
bool
$forceRaw = false
Methods¶
__construct()¶
public function __construct(
EscaperInterface $escaper,
Doctype|null $doctype = null,
bool $forceRaw = false
);
__invoke()¶
Produce a <button> tag.
Html\Helper\Close¶
Class Source on GitHub
Class Close
Phalcon\Html\Helper\AbstractHelperPhalcon\Html\Helper\Close
Method Summary¶
Methods¶
__invoke()¶
Produce a </...> tag.
Html\Helper\Doctype¶
Class Source on GitHub
Creates Doctype tags
Phalcon\Html\Helper\Doctype
Method Summary¶
public
static
__invoke(int $type = self::HTML5,string $delimiter = PHP_EOL)
Produce a <doctype> tag
public
string
__toString()
public
int
getType()
Constants¶
int
HTML32 = 1
int
HTML401_FRAMESET = 4
int
HTML401_STRICT = 2
int
HTML401_TRANSITIONAL = 3
int
HTML5 = 5
int
XHTML10_FRAMESET = 8
int
XHTML10_STRICT = 6
int
XHTML10_TRANSITIONAL = 7
int
XHTML11 = 9
int
XHTML20 = 10
int
XHTML5 = 11
Methods¶
__invoke()¶
Produce a
__toString()¶
getType()¶
Html\Helper\Element¶
Class Source on GitHub
Class Element
@property bool $forceRaw
Phalcon\Html\Helper\AbstractHelperPhalcon\Html\Helper\Element
Uses Phalcon\Html\Escaper\EscaperInterface
Method Summary¶
public
__construct(EscaperInterface $escaper,Doctype|null $doctype = null,bool $forceRaw = false)
public
string
__invoke(string $tag,string $text,array $attributes = [],bool $raw = false)
Produce a tag.
Properties¶
protected
bool
$forceRaw = false
Methods¶
__construct()¶
public function __construct(
EscaperInterface $escaper,
Doctype|null $doctype = null,
bool $forceRaw = false
);
__invoke()¶
public function __invoke(
string $tag,
string $text,
array $attributes = [],
bool $raw = false
): string;
Produce a tag.
Html\Helper\Form¶
Class Source on GitHub
Class Form
Phalcon\Html\Helper\AbstractHelperPhalcon\Html\Helper\Form
Method Summary¶
Methods¶
__invoke()¶
Produce a