| 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\Classes\Arrayable\Array_Tools; |
| 8 |
use Jet_Form_Builder\Rest_Api\Rest_Endpoint; |
| 9 |
use Jet_Form_Builder\Rest_Api\Traits\Rest_Fetch_Endpoint; |
| 10 |
use JFB_Components\Admin\Page\Traits\Table_Advanced_Record_Prepare_Trait; |
| 11 |
|
| 12 |
// If this file is called directly, abort. |
| 13 |
if ( ! defined( 'WPINC' ) ) { |
| 14 |
die; |
| 15 |
} |
| 16 |
|
| 17 |
abstract class Base_List_Box extends Base_Meta_Box implements |
| 18 |
Rest_Fetch_Endpoint, |
| 19 |
Meta_Box_Options { |
| 20 |
|
| 21 |
use Table_Advanced_Record_Prepare_Trait; |
| 22 |
|
| 23 |
final public function get_values(): array { |
| 24 |
return $this->prepare_record( $this->get_list() ); |
| 25 |
} |
| 26 |
|
| 27 |
public function get_raw_list( array $args ): array { |
| 28 |
return array(); |
| 29 |
} |
| 30 |
|
| 31 |
public function get_single(): array { |
| 32 |
return array(); |
| 33 |
} |
| 34 |
|
| 35 |
public function get_rest_url(): string { |
| 36 |
return ''; |
| 37 |
} |
| 38 |
|
| 39 |
public function get_rest_methods(): string { |
| 40 |
return ''; |
| 41 |
} |
| 42 |
|
| 43 |
public function is_editable_table(): bool { |
| 44 |
return false; |
| 45 |
} |
| 46 |
|
| 47 |
public function is_editable_table_control(): bool { |
| 48 |
return false; |
| 49 |
} |
| 50 |
|
| 51 |
/** |
| 52 |
* @return Base_Page_Action[] |
| 53 |
*/ |
| 54 |
public function get_actions(): array { |
| 55 |
return array(); |
| 56 |
} |
| 57 |
|
| 58 |
public function to_array(): array { |
| 59 |
return array_merge( |
| 60 |
parent::to_array(), |
| 61 |
( new Meta_Box_Options_Converter( $this ) )->to_array(), |
| 62 |
array( |
| 63 |
'columns' => $this->get_columns_headings(), |
| 64 |
'single_endpoint' => $this->get_single(), |
| 65 |
'render_type' => self::TYPE_LIST, |
| 66 |
'receive_url' => ( new Rest_Endpoint( $this ) )->to_array(), |
| 67 |
'box_actions' => Array_Tools::to_array( $this->get_actions() ), |
| 68 |
) |
| 69 |
); |
| 70 |
} |
| 71 |
|
| 72 |
} |
| 73 |
|