Skip to content
Snippets Groups Projects
Select Git revision
  • b5f099163feab3394df29e6e1324a7b375c04696
  • master default protected
  • feat/npm-publish
  • feat/demo-deploy
  • change-demo-deploy
  • remove-smoke
  • feat/acceptance-tests
  • feature/deploy-composer.json
  • feature/mysql-bin-logs
  • skip-codecept-for-libs
  • include-composer-json
  • exclude-wp-assets
  • update_codecept_image
  • fix/silenced-copy
  • remove-free-translations
  • codeception-with-optional-step
  • improve-parallelization
  • linter-exit
  • change-images
  • fix/linter
  • globally-raise-mem-limit
  • no-symlink2
22 results

codeception.yml

Blame
  • Form.php 1.63 KiB
    <?php
    
    namespace WPDesk\Forms;
    
    use WPDesk\View\Renderer\Renderer;
    
    /**
     * Abstraction layer for forms.
     *
     * @package WPDesk\Forms
     */
    interface Form {
    	/**
    	 * For some reason you may want to disable a form. Returns false when disabled.
    	 */
    	public function is_active(): bool;
    
    	/**
    	 * Whether form handle_request method was successfully executed.
    	 */
    	public function is_submitted(): bool;
    
    	/**
    	 * After handle_request or set_data the data in form can be invalid according to field validators.
    	 * Returns false when one of them says the data is invalid.
    	 */
    	public function is_valid(): bool;
    
    	/**
    	 * Add array to update data.
    	 *
    	 * @param array $request New data to update.
    	 *
    	 * @return void
    	 */
    	public function handle_request( array $request = [] );
    
    	/**
    	 * Data could be saved in some place. Use this method to transmit them to form.
    	 *
    	 * @param array $data Data for form.
    	 *
    	 * @return void
    	 */
    	public function set_data( array $data );
    
    	/**
    	 * Use to render the form to string.
    	 *
    	 * @param Renderer $renderer Renderer to render form fields and form-templates.
    	 */
    	public function render_form( Renderer $renderer ): string;
    
    	/**
    	 * Get data from form. Use after handle_request or set_data.
    	 *
    	 * @return array<int,string>
    	 */
    	public function get_data(): array;
    
    	/**
    	 * Get data from form. Use after handle_request or set_data.
    	 * The difference get_data is that here you will not get any objects and complex data types besides arrays.
    	 *
    	 * @return array
    	 */
    	public function get_normalized_data(): array;
    
    	/**
    	 * Form if you ever need to have more than one form at once.
    	 */
    	public function get_form_id(): int;
    }