Sections

Class Phalcon\Tag

Source on GitHub

Namespace Phalcon   Uses Phalcon\Di\DiInterface, Phalcon\Escaper\EscaperInterface, Phalcon\Tag\Select, Phalcon\Tag\Exception, Phalcon\Url\UrlInterface

Phalcon\Tag is designed to simplify building of HTML tags. It provides a set of helpers to generate HTML in a dynamic way. This component is a class that you can extend to add more helpers.

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

//
protected static autoEscape = true;

/**
 * DI Container
 */
protected static container;

/**
 * Pre-assigned values for components
 */
protected static displayValues;

//
protected static documentAppendTitle;

//
protected static documentPrependTitle;

/**
 * HTML document title
 */
protected static documentTitle;

//
protected static documentTitleSeparator;

//
protected static documentType = 11;

//
protected static escaperService;

//
protected static urlService;

Methods

public static function appendTitle( mixed $title ): void;

Appends a text to current document title

public static function checkField( mixed $parameters ): string;

Builds a HTML input[type=”check”] tag

public static function colorField( mixed $parameters ): string;

Builds a HTML input[type=”color”] tag

public static function dateField( mixed $parameters ): string;

Builds a HTML input[type=”date”] tag

public static function dateTimeField( mixed $parameters ): string;

Builds a HTML input[type=”datetime”] tag

public static function dateTimeLocalField( mixed $parameters ): string;

Builds a HTML input[type=”datetime-local”] tag

public static function displayTo( string $id, mixed $value ): void;

Alias of Phalcon\Tag::setDefault()

public static function emailField( mixed $parameters ): string;

Builds a HTML input[type=”email”] tag

public static function endForm(): string;

Builds a HTML close FORM tag

public static function fileField( mixed $parameters ): string;

Builds a HTML input[type=”file”] tag

public static function form( mixed $parameters ): string;

Builds a HTML FORM tag

public static function friendlyTitle( string $text, string $separator = string, bool $lowercase = bool, mixed $replace = null ): string;

Converts texts into URL-friendly titles

public static function getDI(): DiInterface;

Internally gets the request dispatcher

public static function getDocType(): string;

Get the document type declaration of content

public static function getEscaper( array $params ): EscaperInterface | null;

Obtains the ‘escaper’ service if required

public static function getEscaperService(): EscaperInterface;

Returns an Escaper service from the default DI

public static function getTitle( bool $prepend = bool, bool $append = bool ): string;

Gets the current document title. The title will be automatically escaped.

public static function getTitleSeparator(): string;

Gets the current document title separator

public static function getUrlService(): UrlInterface;

Returns a URL service from the default DI

public static function getValue( mixed $name, array $params = [] );

Every helper calls this function to check whether a component has a predefined value using Phalcon\Tag::setDefault() or value from $_POST

public static function hasValue( mixed $name ): bool;

Check if a helper has a default value set using Phalcon\Tag::setDefault() or value from $_POST

public static function hiddenField( mixed $parameters ): string;

Builds a HTML input[type=”hidden”] tag

public static function image( mixed $parameters = null, bool $local = bool ): string;

Builds HTML IMG tags

public static function imageInput( mixed $parameters ): string;

Builds a HTML input[type=”image”] tag

public static function javascriptInclude( mixed $parameters = null, bool $local = bool ): string;

Builds a SCRIPT[type=”javascript”] tag

public static function linkTo( mixed $parameters, mixed $text = null, mixed $local = bool ): string;

Builds a HTML A tag using framework conventions

public static function monthField( mixed $parameters ): string;

Builds a HTML input[type=”month”] tag

public static function numericField( mixed $parameters ): string;

Builds a HTML input[type=”number”] tag

public static function passwordField( mixed $parameters ): string;

Builds a HTML input[type=”password”] tag

public static function prependTitle( mixed $title ): void;

Prepends a text to current document title

public static function radioField( mixed $parameters ): string;

Builds a HTML input[type=”radio”] tag

public static function rangeField( mixed $parameters ): string;

Builds a HTML input[type=”range”] tag

public static function renderAttributes( string $code, array $attributes ): string;

Renders parameters keeping order in their HTML attributes

public static function renderTitle( bool $prepend = bool, bool $append = bool ): string;

Renders the title with title tags. The title is automaticall escaped

deprecated public static function resetInput(): void;

Resets the request and internal values to avoid those fields will have any default value.

@deprecated Will be removed in 4.0.0

public static function searchField( mixed $parameters ): string;

Builds a HTML input[type=”search”] tag

public static function select( mixed $parameters, mixed $data = null ): string;

Builds a HTML SELECT tag using a Phalcon\Mvc\Model resultset as options

public static function selectStatic( mixed $parameters, mixed $data = null ): string;

Builds a HTML SELECT tag using a PHP array for options

public static function setAutoescape( bool $autoescape ): void;

Set autoescape mode in generated html

public static function setDI( DiInterface $container ): void;

Sets the dependency injector container.

public static function setDefault( string $id, mixed $value ): void;

Assigns default values to generated tags by helpers

public static function setDefaults( array $values, bool $merge = bool ): void;

Assigns default values to generated tags by helpers

public static function setDocType( int $doctype ): void;

Set the document type of content

public static function setTitle( string $title ): void;

Set the title of view content

public static function setTitleSeparator( string $titleSeparator ): void;

Set the title separator of view content

public static function stylesheetLink( mixed $parameters = null, bool $local = bool ): string;

Builds a LINK[rel=”stylesheet”] tag

public static function submitButton( mixed $parameters ): string;

Builds a HTML input[type=”submit”] tag

public static function tagHtml( string $tagName, mixed $parameters = null, bool $selfClose = bool, bool $onlyStart = bool, bool $useEol = bool ): string;

Builds a HTML tag

public static function tagHtmlClose( string $tagName, bool $useEol = bool ): string;

Builds a HTML tag closing tag

public static function telField( mixed $parameters ): string;

Builds a HTML input[type=”tel”] tag

public static function textArea( mixed $parameters ): string;

Builds a HTML TEXTAREA tag

public static function textField( mixed $parameters ): string;

Builds a HTML input[type=”text”] tag

public static function timeField( mixed $parameters ): string;

Builds a HTML input[type=”time”] tag

public static function urlField( mixed $parameters ): string;

Builds a HTML input[type=”url”] tag

public static function weekField( mixed $parameters ): string;

Builds a HTML input[type=”week”] tag

static final protected function inputField( string $type, mixed $parameters, bool $asValue = bool ): string;

Builds generic INPUT tags

static final protected function inputFieldChecked( string $type, mixed $parameters ): string;

Builds INPUT tags that implements the checked attribute

Class Phalcon\Tag\Exception

Source on GitHub

Namespace Phalcon\Tag   Extends \Phalcon\Exception

Phalcon\Tag\Exception

Exceptions thrown in Phalcon\Tag will use this class

Abstract Class Phalcon\Tag\Select

Source on GitHub

Namespace Phalcon\Tag   Uses Phalcon\Tag\Exception, Phalcon\Tag, Phalcon\Escaper\EscaperInterface, Phalcon\Mvc\Model\ResultsetInterface

Phalcon\Tag\Select

Generates a SELECT html tag using a static array of values or a Phalcon\Mvc\Model resultset

Methods

public static function selectField( mixed $parameters, mixed $data = null ): string;

Generates a SELECT tag