PHP Класс Habari\FormUI

For a list of options to customize its output or behavior see FormUI::set_option()
Наследование: extends FormContainer, implements IsContent
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$dom
$formtype
$properties
$registered_forms
$submitted
$success
$success_render If this is not false, this value should be rendered instead of the form as a success response

Открытые методы

Метод Описание
__construct ( string $name, string $formtype = null, array $extra_data = [] ) FormUI's constructor, called on instantiation.
__toString ( ) : string Convert this object instance to a string
bounce ( $keep_hash = true ) Redirect the user back to the stored URL value in session
build ( string $name, string $formtype = null, array $extra_data = [] ) : FormUI Create a new instance of this class and return it, use the fluent interface
content_type ( ) : array Implementation of IsContent
dupe ( Theme $theme = null ) : string Produce a form "duplicate" that does not process the form, display output, or include one-time-javascripts
from_html ( string $name, string $html ) : FormUI Create a form with controls from HTML
get ( Theme $theme = null ) : string Produce a form with the contained fields.
get_id_component ( ) : string Get a string that will be used to generate a component of a control's HTML id
has_session_data ( ) : boolean Get whether there is session data stored for this form
media_panel ( string $path, string $panel, string $callback ) Configure all the options necessary to make this form work inside a media bar panel
out ( ) Output a form with the contained fields.
output_controls ( Theme $theme ) : string Return the form control HTML.
post_redirect ( string $url = null ) : string Process a form, then redirect, saving control values on errors for redisplay
pre_out_controls ( ) : string Return pre-output control configuration scripts for any controls that require them.
register ( string $name, Callable $build_callback ) Register a function to use to create a new form
set_from_error_values ( ) Set the values of the form controls from their session error values, if stored
simulate ( array $data, boolean $do_wsse_and_id = false ) Simulate posting data to this form

Описание методов

__construct() публичный Метод

FormUI's constructor, called on instantiation.
public __construct ( string $name, string $formtype = null, array $extra_data = [] )
$name string The name of the form, used to differentiate multiple forms.
$formtype string The type of the form, used to classify form types for plugin modification
$extra_data array An array of extra data that can be passed into the form

__toString() публичный Метод

Convert this object instance to a string
public __toString ( ) : string
Результат string The form as HTML

bounce() публичный Метод

Redirect the user back to the stored URL value in session
public bounce ( $keep_hash = true )

build() публичный статический Метод

Create a new instance of this class and return it, use the fluent interface
public static build ( string $name, string $formtype = null, array $extra_data = [] ) : FormUI
$name string The name of the form to build
$formtype string The type of the form
$extra_data array Extra data to pass to the form for configuration purposes
Результат FormUI The instance of the created form

content_type() публичный Метод

Implementation of IsContent
public content_type ( ) : array
Результат array An array of content types that this object represents, starting with the most specific

dupe() публичный Метод

Produce a form "duplicate" that does not process the form, display output, or include one-time-javascripts
public dupe ( Theme $theme = null ) : string
$theme Theme The theme to render the controls into
Результат string HTML form generated from all controls assigned to this form

from_html() публичный статический Метод

Create a form with controls from HTML
public static from_html ( string $name, string $html ) : FormUI
$name string Name of the form
$html string HTML of a form
Результат FormUI The form created from the supplied HTML

get() публичный Метод

Produce a form with the contained fields.
public get ( Theme $theme = null ) : string
$theme Theme The theme to render the controls into
Результат string HTML form generated from all controls assigned to this form

get_id_component() публичный Метод

Get a string that will be used to generate a component of a control's HTML id
public get_id_component ( ) : string
Результат string

has_session_data() публичный Метод

Get whether there is session data stored for this form
public has_session_data ( ) : boolean
Результат boolean True if this form has session data set

media_panel() публичный Метод

Configure all the options necessary to make this form work inside a media bar panel
public media_panel ( string $path, string $panel, string $callback )
$path string Identifies the silo
$panel string The panel in the silo to submit to
$callback string Javascript function to call on form submission

out() публичный Метод

Calls $this->get() and echoes.
public out ( )

output_controls() публичный Метод

Return the form control HTML.
public output_controls ( Theme $theme ) : string
$theme Theme The theme used to render the controls
Результат string The output of controls' HTML.

post_redirect() публичный Метод

Process a form, then redirect, saving control values on errors for redisplay
public post_redirect ( string $url = null ) : string
$url string The URL to redirect to, presumably with the original form on it
Результат string The form output, if needed

pre_out_controls() публичный Метод

Return pre-output control configuration scripts for any controls that require them.
public pre_out_controls ( ) : string
Результат string The output of controls' pre-output HTML.

register() публичный статический Метод

Register a function to use to create a new form
public static register ( string $name, Callable $build_callback )
$name string The name of the form to register
$build_callback Callable The method to call to customize a form instance (FormUI $form, string $name, string $form_type)

set_from_error_values() публичный Метод

Set the values of the form controls from their session error values, if stored

simulate() публичный Метод

Simulate posting data to this form
public simulate ( array $data, boolean $do_wsse_and_id = false )
$data array An associative array of data to simultae adding to the $_POST array
$do_wsse_and_id boolean Default is false. If true, add this form's id and correct WSSE values to the $_POST array

Описание свойств

$dom публичное свойство

public $dom

$formtype публичное свойство

public $formtype

$properties публичное свойство

public $properties

$registered_forms публичное статическое свойство

public static $registered_forms

$submitted публичное свойство

public $submitted

$success публичное свойство

public $success

$success_render публичное свойство

If this is not false, this value should be rendered instead of the form as a success response
public $success_render