PHP Class Habari\FormUI

For a list of options to customize its output or behavior see FormUI::set_option()
Inheritance: extends FormContainer, implements IsContent
Afficher le fichier Open project: habari/system Class Usage Examples

Méthodes publiques

Свойство Type Description
$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

Méthodes publiques

Méthode Description
__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

Method Details

__construct() public méthode

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() public méthode

Convert this object instance to a string
public __toString ( ) : string
Résultat string The form as HTML

bounce() public méthode

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

build() public static méthode

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
Résultat FormUI The instance of the created form

content_type() public méthode

Implementation of IsContent
public content_type ( ) : array
Résultat array An array of content types that this object represents, starting with the most specific

dupe() public méthode

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
Résultat string HTML form generated from all controls assigned to this form

from_html() public static méthode

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
Résultat FormUI The form created from the supplied HTML

get() public méthode

Produce a form with the contained fields.
public get ( Theme $theme = null ) : string
$theme Theme The theme to render the controls into
Résultat string HTML form generated from all controls assigned to this form

get_id_component() public méthode

Get a string that will be used to generate a component of a control's HTML id
public get_id_component ( ) : string
Résultat string

has_session_data() public méthode

Get whether there is session data stored for this form
public has_session_data ( ) : boolean
Résultat boolean True if this form has session data set

media_panel() public méthode

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() public méthode

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

output_controls() public méthode

Return the form control HTML.
public output_controls ( Theme $theme ) : string
$theme Theme The theme used to render the controls
Résultat string The output of controls' HTML.

post_redirect() public méthode

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
Résultat string The form output, if needed

pre_out_controls() public méthode

Return pre-output control configuration scripts for any controls that require them.
public pre_out_controls ( ) : string
Résultat string The output of controls' pre-output HTML.

register() public static méthode

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() public méthode

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

simulate() public méthode

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

Property Details

$dom public_oe property

public $dom

$formtype public_oe property

public $formtype

$properties public_oe property

public $properties

$registered_forms public_oe static_oe property

public static $registered_forms

$submitted public_oe property

public $submitted

$success public_oe property

public $success

$success_render public_oe property

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