actions
4 years ago
columns
4 years ago
column-advanced-base.php
4 years ago
column-base.php
4 years ago
column-heading-interface.php
4 years ago
column-heading-trait.php
4 years ago
view-advanced-base.php
4 years ago
view-base.php
4 years ago
view-simple-base.php
4 years ago
view-base.php
79 lines
| 1 | <?php |
| 2 | |
| 3 | |
| 4 | namespace Jet_Form_Builder\Admin\Table_Views; |
| 5 | |
| 6 | use Jet_Form_Builder\Classes\Repository\Repository_Item_With_Class; |
| 7 | use Jet_Form_Builder\Classes\Repository\Repository_Static_Item_It; |
| 8 | use Jet_Form_Builder\Db_Queries\Exceptions\Sql_Exception; |
| 9 | use Jet_Form_Builder\Db_Queries\Traits\Model_Dependencies; |
| 10 | use Jet_Form_Builder\Db_Queries\Traits\Model_Dependencies_Interface; |
| 11 | |
| 12 | abstract class View_Base implements |
| 13 | Repository_Static_Item_It, |
| 14 | Model_Dependencies_Interface { |
| 15 | |
| 16 | use Repository_Item_With_Class; |
| 17 | use Model_Dependencies; |
| 18 | |
| 19 | abstract public function get_prepared_list( array $custom_list = array() ): array; |
| 20 | |
| 21 | public function get_list(): array { |
| 22 | return $this->get_raw_list( |
| 23 | array( |
| 24 | 'offset' => 0, |
| 25 | 'limit' => 15, |
| 26 | ) |
| 27 | ); |
| 28 | } |
| 29 | |
| 30 | public function get_global_actions(): array { |
| 31 | return array(); |
| 32 | } |
| 33 | |
| 34 | public function get_total(): int { |
| 35 | return 0; |
| 36 | } |
| 37 | |
| 38 | public function get_empty_message(): string { |
| 39 | return __( 'No items found.', 'jet-form-builder' ); |
| 40 | } |
| 41 | |
| 42 | public function get_receive_endpoint(): array { |
| 43 | return array(); |
| 44 | } |
| 45 | |
| 46 | public function load_data(): array { |
| 47 | return array(); |
| 48 | } |
| 49 | |
| 50 | /** |
| 51 | * @return array |
| 52 | */ |
| 53 | final public function load_view(): array { |
| 54 | try { |
| 55 | $this->prepare_dependencies(); |
| 56 | } catch ( Sql_Exception $exception ) { |
| 57 | return array( |
| 58 | 'list' => array(), |
| 59 | 'columns' => array(), |
| 60 | 'actions' => array(), |
| 61 | ); |
| 62 | } |
| 63 | |
| 64 | return array_merge( |
| 65 | array( |
| 66 | 'list' => $this->get_prepared_list(), |
| 67 | 'columns' => $this->get_columns_headings(), |
| 68 | 'actions' => $this->get_global_actions(), |
| 69 | 'total' => $this->get_total(), |
| 70 | 'receive_url' => $this->get_receive_endpoint(), |
| 71 | 'empty_message' => $this->get_empty_message(), |
| 72 | ), |
| 73 | $this->load_data() |
| 74 | ); |
| 75 | } |
| 76 | |
| 77 | |
| 78 | } |
| 79 |