Field
1 week ago
Form
1 week ago
Persistence
1 week ago
Renderer
1 week ago
Resolver
1 week ago
Sanitizer
1 week ago
Serializer
1 week ago
Validator
1 week ago
ContainerForm.php
1 week ago
Escaper.php
1 week ago
Field.php
1 week ago
FieldProvider.php
1 week ago
FieldRenderer.php
1 week ago
FieldsDataReceiver.php
1 week ago
Form.php
1 week ago
Sanitizer.php
1 week ago
Serializer.php
1 week ago
Validator.php
1 week ago
Form.php
72 lines
| 1 | <?php |
| 2 | |
| 3 | namespace FSVendor\WPDesk\Forms; |
| 4 | |
| 5 | use FSVendor\WPDesk\View\Renderer\Renderer; |
| 6 | /** |
| 7 | * Abstraction layer for forms. |
| 8 | * |
| 9 | * @package WPDesk\Forms |
| 10 | */ |
| 11 | interface Form |
| 12 | { |
| 13 | /** |
| 14 | * For some reason you may want to disable a form. Returns false when disabled. |
| 15 | * |
| 16 | * @return bool |
| 17 | */ |
| 18 | public function is_active(); |
| 19 | /** |
| 20 | * Whether form handle_request method was successfully executed. |
| 21 | * |
| 22 | * @return bool |
| 23 | */ |
| 24 | public function is_submitted(); |
| 25 | /** |
| 26 | * After handle_request or set_data the data in form can be invalid according to field validators. |
| 27 | * Returns false when onle of them says the data is invalid. |
| 28 | * |
| 29 | * @return bool |
| 30 | */ |
| 31 | public function is_valid(); |
| 32 | /** |
| 33 | * Add array to update data. |
| 34 | * |
| 35 | * @param array $request New data to update. |
| 36 | */ |
| 37 | public function handle_request($request = array()); |
| 38 | /** |
| 39 | * Data could be saved in some place. Use this method to transmit them to form. |
| 40 | * |
| 41 | * @param array $data Data for form. |
| 42 | */ |
| 43 | public function set_data($data); |
| 44 | /** |
| 45 | * Use to render the form to string. |
| 46 | * |
| 47 | * @param Renderer $renderer Renderer to render form fields and form-templates. |
| 48 | * |
| 49 | * @return string |
| 50 | */ |
| 51 | public function render_form(Renderer $renderer); |
| 52 | /** |
| 53 | * Get data from form. Use after handle_request or set_data. |
| 54 | * |
| 55 | * @return array |
| 56 | */ |
| 57 | public function get_data(); |
| 58 | /** |
| 59 | * Get data from form. Use after handle_request or set_data. |
| 60 | * The difference get_data is that here you will not get any objects and complex data types besides arrays. |
| 61 | * |
| 62 | * @return array |
| 63 | */ |
| 64 | public function get_normalized_data(); |
| 65 | /** |
| 66 | * Form if you ever need to have more than one form at once. |
| 67 | * |
| 68 | * @return string |
| 69 | */ |
| 70 | public function get_form_id(); |
| 71 | } |
| 72 |