PluginProbe
HTML Forms – Simple WordPress Forms Plugin / 1.0.3
HTML Forms – Simple WordPress Forms Plugin v1.0.3
trunk 1.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.1 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.2.0 1.3.0 1.3.1 1.3.10 1.3.11 1.3.12 1.3.13 1.3.14 1.3.15 1.3.16 1.3.17 All 66 releases
html-forms / src / Actions / Action.php

Action.php in HTML Forms – Simple WordPress Forms Plugin 1.0.3, at src/Actions/Action.php

37 lines 911 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace HTML_Forms\Actions;
4
5 use HTML_Forms\Form;
6 use HTML_Forms\Submission;
7
8 abstract class Action {
9
10 public $type = '';
11 public $label = '';
12
13 public function hook() {
14 add_filter( 'hf_available_form_actions', array( $this, 'register' ) );
15 add_action( 'hf_render_form_action_' . $this->type . '_settings', array( $this, 'page_settings' ) );
16 add_action( 'hf_process_form_action_' . $this->type, array( $this, 'process' ), 10, 3 );
17 }
18
19 /**
20 * Renders the settings for this action.
21 *
22 * @param array $settings
23 */
24 abstract function page_settings( $settings );
25
26 abstract function process( array $settings, Submission $submission, Form $form );
27
28 /**
29 * @param array $actions
30 * @return array
31 */
32 public function register( array $actions ) {
33 $actions[$this->type] = $this->label;
34 return $actions;
35 }
36 }
37