PluginProbe
HTML Forms – Simple WordPress Forms Plugin / 1.3.22
HTML Forms – Simple WordPress Forms Plugin v1.3.22
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 / class-action.php

class-action.php in HTML Forms – Simple WordPress Forms Plugin 1.3.22, at src/actions/class-action.php

38 lines 873 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_output_form_action_' . $this->type . '_settings', array( $this, 'page_settings' ), 10, 2 );
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 * @param string $index
24 */
25 abstract function page_settings( $settings, $index );
26
27 abstract function process( array $settings, Submission $submission, Form $form );
28
29 /**
30 * @param array $actions
31 * @return array
32 */
33 public function register( array $actions ) {
34 $actions[ $this->type ] = $this->label;
35 return $actions;
36 }
37 }
38