base-list-box.php
3 years ago
base-meta-box.php
3 years ago
base-table-box.php
3 years ago
meta-box-options-converter.php
3 years ago
meta-box-options.php
3 years ago
meta-box-update-callback.php
3 years ago
meta-table-options-converter.php
3 years ago
meta-table-options.php
3 years ago
base-list-box.php
68 lines
| 1 | <?php |
| 2 | |
| 3 | |
| 4 | namespace Jet_Form_Builder\Admin\Single_Pages\Meta_Boxes; |
| 5 | |
| 6 | use Jet_Form_Builder\Admin\Pages\Actions\Base_Page_Action; |
| 7 | use Jet_Form_Builder\Admin\Table_Advanced_Record_Prepare_Trait; |
| 8 | use Jet_Form_Builder\Classes\Arrayable\Array_Tools; |
| 9 | use Jet_Form_Builder\Rest_Api\Rest_Endpoint; |
| 10 | use Jet_Form_Builder\Rest_Api\Traits\Rest_Fetch_Endpoint; |
| 11 | |
| 12 | abstract class Base_List_Box extends Base_Meta_Box implements |
| 13 | Rest_Fetch_Endpoint, |
| 14 | Meta_Box_Options { |
| 15 | |
| 16 | use Table_Advanced_Record_Prepare_Trait; |
| 17 | |
| 18 | final public function get_values(): array { |
| 19 | return $this->prepare_record( $this->get_list() ); |
| 20 | } |
| 21 | |
| 22 | public function get_raw_list( array $args ): array { |
| 23 | return array(); |
| 24 | } |
| 25 | |
| 26 | public function get_single(): array { |
| 27 | return array(); |
| 28 | } |
| 29 | |
| 30 | public function get_rest_url(): string { |
| 31 | return ''; |
| 32 | } |
| 33 | |
| 34 | public function get_rest_methods(): string { |
| 35 | return ''; |
| 36 | } |
| 37 | |
| 38 | public function is_editable_table(): bool { |
| 39 | return false; |
| 40 | } |
| 41 | |
| 42 | public function is_editable_table_control(): bool { |
| 43 | return false; |
| 44 | } |
| 45 | |
| 46 | /** |
| 47 | * @return Base_Page_Action[] |
| 48 | */ |
| 49 | public function get_actions(): array { |
| 50 | return array(); |
| 51 | } |
| 52 | |
| 53 | public function to_array(): array { |
| 54 | return array_merge( |
| 55 | parent::to_array(), |
| 56 | ( new Meta_Box_Options_Converter( $this ) )->to_array(), |
| 57 | array( |
| 58 | 'columns' => $this->get_columns_headings(), |
| 59 | 'single_endpoint' => $this->get_single(), |
| 60 | 'render_type' => self::TYPE_LIST, |
| 61 | 'receive_url' => ( new Rest_Endpoint( $this ) )->to_array(), |
| 62 | 'box_actions' => Array_Tools::to_array( $this->get_actions() ), |
| 63 | ) |
| 64 | ); |
| 65 | } |
| 66 | |
| 67 | } |
| 68 |