PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 2.1.6
JetFormBuilder — Dynamic Blocks Form Builder v2.1.6
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 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.1.0 2.1.1 2.1.10 2.1.11 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 3.0.0 3.0.0.1 3.0.0.2 3.0.0.3 3.0.1 3.0.1.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.0.1 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.2 3.2.3 3.3.0 3.3.1 3.3.2 3.3.3 3.3.3.1 3.3.4 3.3.4.1 3.3.4.2 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.5.1 3.4.5.2 3.4.6 3.4.7 3.4.7.1 3.5.0 3.5.1 3.5.1.1 3.5.1.2 3.5.2 3.5.2.1 3.5.3 3.5.4 3.5.5 3.5.6 3.5.6.1 3.5.6.2 3.5.6.3 3.6.0
jetformbuilder / includes / admin / table-views / column-base.php
jetformbuilder / includes / admin / table-views Last commit date
actions 3 years ago columns 3 years ago column-advanced-base.php 3 years ago column-base.php 3 years ago column-heading-interface.php 3 years ago column-heading-trait.php 3 years ago view-advanced-base.php 3 years ago view-base.php 3 years ago view-simple-base.php 3 years ago
column-base.php
106 lines
1 <?php
2
3
4 namespace Jet_Form_Builder\Admin\Table_Views;
5
6 abstract class Column_Base {
7
8 const CHOOSE = 'choose';
9 const ACTIONS = 'actions';
10 const CLASSES = 'classes';
11 const STATUS = 'icon_status';
12 const PRE = 'pre';
13 const LINK = 'link';
14 const STATUS_SUCCESS = 'success';
15 const STATUS_INFO = 'info';
16 const STATUS_WARNING = 'warning';
17 const STATUS_FAILED = 'failed';
18 const STATUS_PENDING = 'pending';
19
20 protected $column = '';
21 protected $type = 'string';
22
23 public function __construct( $column = '' ) {
24 $this->set_column( $column );
25 }
26
27 final public function set_column( $column ): Column_Base {
28 if ( empty( $this->column ) && $column ) {
29 $this->column = $column;
30 }
31
32 return $this;
33 }
34
35 public function get_value( array $record = array() ) {
36 return $record[ $this->column ] ?? false;
37 }
38
39 public function get_type( array $record = array() ): string {
40 return $this->type;
41 }
42
43 public function is_editable( array $record = array() ): bool {
44 return false;
45 }
46
47 public function get_control( array $record = array() ): string {
48 return 'input';
49 }
50
51 public function get_control_options( array $record = array() ): array {
52 return array(
53 'type' => 'text',
54 );
55 }
56
57 public function get_options( array $record = array() ): array {
58 return array();
59 }
60
61 public function get_css_classes( array $record = array() ): array {
62 return array();
63 }
64
65 final public function get_column( array $record ): array {
66 $type = $this->get_type( $record );
67 $value = $this->prepare_value( $this->get_value( $record ), $type );
68 $editable = $this->is_editable( $record );
69 $options = $this->get_options( $record );
70 $classes = $this->get_css_classes( $record );
71 $control = 'input';
72 $control_options = array();
73
74 if ( $editable ) {
75 $control = $this->get_control( $record );
76 $control_options = $this->get_control_options( $record );
77 }
78
79 return array(
80 'type' => $type,
81 'value' => $value,
82 'editable' => $editable,
83 'control' => $control,
84 'control_options' => $control_options,
85 'classes' => $classes,
86 ) + $options;
87 }
88
89 protected function prepare_value( $value, $type ) {
90 switch ( $type ) {
91 case 'integer':
92 return (int) $value;
93 case 'price':
94 return number_format( $value, 2 );
95 case 'array':
96 return (array) $value;
97 case 'string':
98 return (string) $value;
99 case 'rawArray':
100 default:
101 return $value;
102 }
103 }
104
105 }
106