Form


Class: \Flextype\Component\Form\Form

Visibility Function
public static __callStatic(string $method, array $parameters) : mixed
Dynamically handle calls to custom macros.
public static button(string $name, mixed $body, array $attributes=null) : string
Creates a button form input. echo Form::button('save', 'Save Profile', array('type' => 'submit'));
public static checkbox(string $name, string $value='', bool/boolean $checked=false, array $attributes=null) : string
Creates a checkbox form input. echo Form::checkbox('i_am_not_a_robot');
public static close() : string
Create closing form tag. echo Form::close();
public static file(\string $name, array $attributes=null) : string
Creates a file upload form input. echo Form::file('image');
public static hidden(\string $name, \string $value='', array $attributes=null) : string
Create a hidden form input. echo Form::hidden('user_id', $user_id);
public static input(\string $name, \string $value='', array $attributes=null) : string
Create a form input. Text is default input type. echo Form::input('username', $username);
public static label(string $input, string $text, array $attributes=null) : string
Creates a form label. echo Form::label('username', 'Username');
public static macro(\string $name, \Flextype\Component\Form\Closure $macro) : void
Registers a custom macro. // Registering a Form macro Form::macro('my_field', function() { return ''; }); // Calling a custom Form macro echo Form::my_field(); // Registering a Form macro with parameters Form::macro('my_field', function($value = '') { return ''; }); // Calling a custom Form macro with parameters echo Form::my_field('Flextype');
public static open(string $action='', array $attributes=null) : string
Create an opening HTML form tag. // Form will submit back to the current page using POST echo Form::open(); // Form will submit to 'search' using GET echo Form::open('search', array('method' => 'get')); // When "file" inputs are present, you must include the "enctype" echo Form::open(null, array('enctype' => 'multipart/form-data'));
public static password(\string $name, \string $value='', array $attributes=null) : string
Creates a password form input. echo Form::password('password');
public static radio(string $name, string $value='', boolean $checked=null, array $attributes=null) : string
Creates a radio form input. echo Form::radio('i_am_not_a_robot');
public static select(string $name, array $options=null, string $selected=null, array $attributes=null) : string
Creates a select form input. echo Form::select('themes', array('default', 'classic', 'modern'));
public static submit(string $name, string $value, array $attributes=null) : string
Creates a submit form input. echo Form::submit('save', 'Save');
public static textarea(string $name, string $body='', array $attributes=null) : string
Creates a textarea form input. echo Form::textarea('text', $text);
Language: en, ru