프로퍼티 | 타입 | 설명 | |
---|---|---|---|
$caption | string | ||
$container | The container that contains this control | ||
$controls_js | True if the controls.init script has been output, false if not | ||
$errors | array | An array of errors that is filled when the control is passed for validation | |
$has_errors | boolean | True when this control has errors, can be true with $errors isn't when the errors propagate to the container | |
$helptext | boolean | string | This is help text for the control, if it is set | |
$initial_value | mixed | This is the intially assigned value of the control, set and used internally | |
$name | string | The name of the control for the purposes of manipulating it from the container object | |
$on_enable | array | An array of enable handlers for this control | |
$on_save | array | An array of save handlers for this control | |
$on_success | array | An array of success handlers for this control | |
$properties | array | Contains an array of properties used to assign to the output HTML | |
$settings | array | Contains an array of settings that control the behavior of this control | |
$storage | habari\FormStorage | null | The storage object for this form | |
$validators | array | An array of validators to execute on this control | |
$value | mixed | This is the value of the control, which will differ depending on at what time you access it | |
$value_set_manually | boolean | If the value of this control was set manually, this should be true | |
$vars | array | These vars are added internally to the theme for output by the template |
메소드 | 설명 | |
---|---|---|
__construct ( string $name, habari\FormStorage | string | null $storage = 'null:null', array $properties = [], array $settings = [] ) | Construct a control. | |
_extend ( ) | This function is called after __construct(). It does nothing, but its descendants might do something. | |
add_class ( array | string $classes ) : |
Add one or more CSS classes to this control | |
add_input_array ( integer | string $value ) : |
Add a value to the input_array setting | |
add_template_class ( string $target, array | string $classes ) : |
Add one or more CSS classes to this control's template | |
add_validator ( mixed $validator, mixed $option = null ) : |
Add a validation function to this control Multiple parameters are passed as parameters to the validation function | |
clear ( ) | Set this control to its initial value | |
control_id ( ) : string | Obtain a unique identifier for this control that is the same every time the form is generated | |
control_type ( ) : string | Get the type of control this is (without the "FormControl" and in lower case) Usually used for template selection | |
controls_js ( string $out ) : string | Render the controls.init script prior to the supplied script only if it hasn't already been rendered | |
create ( string $name, habari\FormStorage | string | null $storage = 'null:null', array $properties = [], array $settings = [] ) : mixed | |
Create a new instance of this class and return it, use the fluent interface | |
do_success ( |
Calls the success callback for the form, and saves the form value to the control's storage location | |
error_wrap ( string $output, array $errors ) : string | Wrap the output of a control (or some text content) with error content | |
from_args ( array $arglist ) : |
Take an array of parameters, use the first as the FormControl class/type, and run the constructor with the rest | |
get ( |
Produce the control for display | |
get_form ( ) : |
Find the form that holds this control | |
get_id ( boolean $force_set = true ) : string | null | Produce a unique id (not name) for this control for use with labels and such, only if one is not provided in the control properties | |
get_id_component ( ) : boolean | string | Get a string that will be used to generate a component of a control's HTML id | |
get_label ( ) : string | Get a text label for this control | |
get_setting ( string $name, mixed $default = null ) : mixed | Get the value of a setting | |
get_template ( ) : array | Get a list of potential templates that can render this control | |
get_theme ( ) : |
Retreive the Theme used to display this form component and its descendants | |
get_visualizer ( ) | Returns the HTML id of the element that the control exposes as a target, for example, for labels | |
input_name ( ) : string | Get the name to use for the input field | |
is_enabled ( ) : boolean | Determine if this controls should be enabled | |
label ( string $label ) : |
Shortcut to wrap this control in a label | |
load ( ) | Load this control's initial data from the initialized storage location | |
on_save ( mixed $callback ) : |
Set a function to call on form submission success | |
on_success ( mixed $callback ) : |
Set a function to call on form submission success | |
pop_input_array ( ) : |
Remove the most recent input_array setting | |
pre_out ( ) : string | Output this once when the control is first output to the page | |
prep_theme ( |
||
process ( ) | Obtain the value of this control as supplied by the incoming $_POST values | |
remove_class ( array | string $classes ) : |
Remove one or more CSS classes from this control | |
remove_validator ( string $name ) | Removes a validation function from this control | |
save ( ) | Save this control's data to the initialized storage location | |
set_container ( |
Set the container for this control | |
set_enable ( Callable $enabler ) : |
Set a function to use to determine if this control should be enabled or provided in the form | |
set_helptext ( string $helptext ) : |
||
set_properties ( array $properties, boolean $override = false ) : |
Set the HTML-related properties of this control | |
set_property ( string $name, mixed $value ) : |
Set an HTML-related property of this control | |
set_setting ( string $name, mixed $value ) : |
Set the value of a single setting | |
set_settings ( array $settings, boolean $override = false ) : |
||
set_storage ( habari\FormStorage | string | null $storage ) : |
Set the storage for this control | |
set_template ( string | array $template ) : |
Set a template for use with this control | |
set_template_html ( Callable | string $template ) : |
Set an HTML value directly for the output of a control | |
set_template_properties ( string $target, array $properties, boolean $override = false ) : |
Set the HTML-related properties of this control's template | |
set_value ( mixed $value, boolean $manually = true ) : |
Set the value of the control | |
validate ( ) : array | Runs any attached validation functions to check validation of this control. | |
wrap_by ( Callable | string $wrapper, mixed $thing ) : string | Process a thing either using an sprintf-style string, or a closure |
public __construct ( string $name, habari\FormStorage | string | null $storage = 'null:null', array $properties = [], array $settings = [] ) | ||
$name | string | The name of the control |
$storage | habari\FormStorage | string | null | A storage location for the data collected by the control |
$properties | array | An array of properties that apply to the output HTML |
$settings | array | An array of settings that apply to this control object |
public _extend ( ) |
public add_input_array ( integer | string $value ) : |
||
$value | integer | string | The value to use as the array part of the input name |
리턴 | $this Fluent interface |
public add_validator ( mixed $validator, mixed $option = null ) : |
||
$validator | mixed | A callback function |
$option | mixed | Multiple parameters added to those used to call the validator callback |
리턴 | Returns the control for chained execution |
public control_id ( ) : string | ||
리턴 | string |
public control_type ( ) : string | ||
리턴 | string | The type of the control in lower case |
public controls_js ( string $out ) : string | ||
$out | string | An existing script that depends on controls.init |
리턴 | string | The script with the controls.init script prepended, if needed |
public static create ( string $name, habari\FormStorage | string | null $storage = 'null:null', array $properties = [], array $settings = [] ) : mixed | |
||
$name | string | The name of the control |
$storage | habari\FormStorage | string | null | A storage location for the data collected by the control |
$properties | array | An array of properties that apply to the output HTML |
$settings | array | An array of settings that apply to this control object |
리턴 | mixed | |
An instance of the referenced FormControl with the supplied parameters |
public do_success ( |
||
$form | The form this control belongs to | |
리턴 | boolean | string | A string to replace the rendering of the form with, or false |
public get_form ( ) : |
||
리턴 | The form that this control is in |
public get_id_component ( ) : boolean | string | ||
리턴 | boolean | string | False if this component doesn't contribute to id creation, or the string component |
public get_template ( ) : array | ||
리턴 | array | An array of template names in fallback order |
public get_theme ( ) : |
||
리턴 | The theme object to display the template for the control |
public get_visualizer ( ) |
public input_name ( ) : string | ||
리턴 | string | The name to use in the HTML for this control |
public is_enabled ( ) : boolean | ||
리턴 | boolean | True if enabled, false if not enabled |
public load ( ) |
public on_success ( mixed $callback ) : |
||
$callback | mixed | A callback function or a plugin filter name (FormUI $form) |
리턴 | $this Fluent interface |
public pop_input_array ( ) : |
||
리턴 | $this Fluent interface |
public process ( ) |
public remove_class ( array | string $classes ) : |
||
$classes | array | string | An array or a string of classes to remove from this control |
리턴 | $this |
public remove_validator ( string $name ) | ||
$name | string | The name of the validator to remove |
public set_container ( |
||
$container | A container that this control is inside |
public set_enable ( Callable $enabler ) : |
||
$enabler | Callable | A function to call to determine if this control should be enabled |
리턴 | $this |
public set_helptext ( string $helptext ) : |
||
$helptext | string | Help text to appear for the control |
리턴 | $this |
public set_properties ( array $properties, boolean $override = false ) : |
||
$properties | array | An array of properties that will be associated to this control's HTML output |
$override | boolean | If true, the supplied properties completely replace the existing ones |
리턴 | $this |
public set_property ( string $name, mixed $value ) : |
||
$name | string | The name of the property to set |
$value | mixed | The value to set the property to |
리턴 | $this |
public set_setting ( string $name, mixed $value ) : |
||
$name | string | The name of the setting |
$value | mixed | The value of the setting |
리턴 | $this Fluent interface |
public set_settings ( array $settings, boolean $override = false ) : |
||
$settings | array | An array of settings that affect the behavior of this control object |
$override | boolean | If true, use the provided array to override the existing one |
리턴 | $this |
public set_storage ( habari\FormStorage | string | null $storage ) : |
||
$storage | habari\FormStorage | string | null | A storage location for the data collected by the control |
리턴 | $this |
public set_template ( string | array $template ) : |
||
$template | string | array | A template fallback list to search for this template |
리턴 | $this |
public set_template_html ( Callable | string $template ) : |
||
$template | Callable | string | The template to use for output of this control |
리턴 | $this |
public set_template_properties ( string $target, array $properties, boolean $override = false ) : |
||
$target | string | the target element in the template to apply the properties to |
$properties | array | An array of properties that will be associated to this control template's HTML output |
$override | boolean | If true, the supplied properties completely replace the existing ones |
리턴 | $this |
public wrap_by ( Callable | string $wrapper, mixed $thing ) : string | ||
$wrapper | Callable | string | An sprintf-style wrapper or a function that accepts the same arguments as the call to this |
$thing | mixed | One or more things to use as parameters to the sprintf/closure |
리턴 | string | The resultant string produced by applying the closure or sprintf template |
public FormContainer,habari $container | ||
리턴 |
static public $controls_js |
public array $errors | ||
리턴 | array |
public bool $has_errors | ||
리턴 | boolean |
public mixed $initial_value | ||
리턴 | mixed |
public string $name | ||
리턴 | string |
public array $on_success | ||
리턴 | array |
public array $properties | ||
리턴 | array |
public array $settings | ||
리턴 | array |
public FormStorage,habari|null $storage | ||
리턴 | habari\FormStorage | null |
public array $validators | ||
리턴 | array |
public mixed $value | ||
리턴 | mixed |
public bool $value_set_manually | ||
리턴 | boolean |
public array $vars | ||
리턴 | array |