action-event-column.php
2 years ago
actions-list-for-column.php
2 years ago
classes-column.php
2 years ago
error-data-column.php
2 years ago
error-message-column.php
2 years ago
error-place-column.php
2 years ago
exception-name-column.php
2 years ago
export-csv-column.php
2 years ago
field-name-column.php
2 years ago
field-type-column.php
2 years ago
field-value-column.php
2 years ago
form-action-column.php
2 years ago
form-action-status-column.php
2 years ago
form-link-column.php
2 years ago
header-actions-column.php
2 years ago
ip-address-column.php
2 years ago
primary-form-column.php
2 years ago
print-pdf-column.php
2 years ago
referrer-link-column.php
2 years ago
row-actions-column.php
2 years ago
status-column.php
2 years ago
user-agent-column.php
2 years ago
user-login-column.php
2 years ago
utils.php
2 years ago
field-value-column.php
76 lines
| 1 | <?php |
| 2 | |
| 3 | |
| 4 | namespace JFB_Modules\Form_Record\Admin\View_Columns; |
| 5 | |
| 6 | use Jet_Form_Builder\Admin\Table_Views\Column_Advanced_Base; |
| 7 | |
| 8 | // If this file is called directly, abort. |
| 9 | if ( ! defined( 'WPINC' ) ) { |
| 10 | die; |
| 11 | } |
| 12 | |
| 13 | class Field_Value_Column extends Column_Advanced_Base { |
| 14 | |
| 15 | protected $column = 'field_value'; |
| 16 | protected $type = self::PRE; |
| 17 | |
| 18 | public function get_label(): string { |
| 19 | return __( 'Value', 'jet-form-builder' ); |
| 20 | } |
| 21 | |
| 22 | public function get_control( array $record = array() ): string { |
| 23 | $type = $record['field_type'] ?? ''; |
| 24 | $control = 'input'; |
| 25 | |
| 26 | switch ( $type ) { |
| 27 | case 'repeater-field': |
| 28 | case 'wysiwyg-field': |
| 29 | case 'textarea-field': |
| 30 | $control = 'textarea'; |
| 31 | break; |
| 32 | } |
| 33 | |
| 34 | return apply_filters( |
| 35 | 'jet-form-builder/table-form-fields/column-value/control', |
| 36 | $control, |
| 37 | $record |
| 38 | ); |
| 39 | } |
| 40 | |
| 41 | public function get_control_options( array $record = array() ): array { |
| 42 | $field_type = $record['field_type'] ?? ''; |
| 43 | $type = 'text'; |
| 44 | |
| 45 | switch ( $field_type ) { |
| 46 | case 'number-field': |
| 47 | case 'calculated-field': |
| 48 | case 'range-field': |
| 49 | $type = 'number'; |
| 50 | break; |
| 51 | case 'color-picker-field': |
| 52 | $type = 'color'; |
| 53 | break; |
| 54 | case 'date-field': |
| 55 | $type = 'date'; |
| 56 | break; |
| 57 | case 'datetime-field': |
| 58 | $type = 'datetime-local'; |
| 59 | break; |
| 60 | case 'time-field': |
| 61 | $type = 'time'; |
| 62 | break; |
| 63 | } |
| 64 | |
| 65 | $options = array( |
| 66 | 'type' => $type, |
| 67 | ); |
| 68 | |
| 69 | return apply_filters( |
| 70 | 'jet-form-builder/table-form-fields/column-value/control-options', |
| 71 | $options, |
| 72 | $record |
| 73 | ); |
| 74 | } |
| 75 | } |
| 76 |