PluginProbe
JetFormBuilder — Dynamic Blocks Form Builder / 3.6.6
JetFormBuilder — Dynamic Blocks Form Builder v3.6.6
3.6.6.1 3.6.6 3.6.5.4 3.6.5.3 3.6.5.2 3.6.5.1 3.6.5 3.6.4.2 3.6.4.1 3.6.4 3.6.3.1 3.6.3 3.6.2.2 3.6.2.1 3.6.2 3.6.1.1 3.6.1 3.6.0.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 All 134 releases
jetformbuilder / includes / admin / pages / actions / base-page-action.php

base-page-action.php in JetFormBuilder — Dynamic Blocks Form Builder 3.6.6, at includes/admin/pages/actions/base-page-action.php

66 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3
4 namespace Jet_Form_Builder\Admin\Pages\Actions;
5
6 use Jet_Form_Builder\Admin\Buttons\Base_Vui_Button;
7 use Jet_Form_Builder\Admin\Pages\Base_Page;
8 use Jet_Form_Builder\Admin\Single_Pages\Base_Single_Page;
9 use Jet_Form_Builder\Classes\Arrayable\Arrayable;
10 use Jet_Form_Builder\Db_Queries\Exceptions\Skip_Exception;
11
12 // If this file is called directly, abort.
13 if ( ! defined( 'WPINC' ) ) {
14 die;
15 }
16
17 abstract class Base_Page_Action implements Arrayable {
18
19 const SECONDARY = 'secondary';
20 const PRIMARY = 'primary';
21 const ON_UPDATE = 'update';
22
23 protected $page;
24
25 abstract public function get_slug(): string;
26
27 public function get_position(): string {
28 return self::SECONDARY;
29 }
30
31 public function get_subscriptions(): array {
32 return array();
33 }
34
35 /**
36 * @param Base_Page|Base_Single_Page $page
37 *
38 * @return $this
39 */
40 public function set_page( $page ): Base_Page_Action {
41 $this->page = $page;
42
43 return $this;
44 }
45
46 public function get_button(): Base_Vui_Button {
47 return ( new Base_Vui_Button() )->set_label( $this->get_slug() );
48 }
49
50 public function to_array(): array {
51 $config = array(
52 'slug' => $this->get_slug(),
53 'position' => $this->get_position(),
54 'subscriptions' => $this->get_subscriptions(),
55 );
56
57 try {
58 $config['button'] = $this->get_button()->to_array();
59 } catch ( Skip_Exception $exception ) {
60 return $config;
61 }
62
63 return $config;
64 }
65 }
66