api-single-action.php
3 years ago
link-single-action.php
3 years ago
view-single-action.php
3 years ago
view-single-action.php
40 lines
| 1 | <?php |
| 2 | |
| 3 | |
| 4 | namespace Jet_Form_Builder\Admin\Table_Views\Actions; |
| 5 | |
| 6 | use Jet_Form_Builder\Classes\Repository\Repository_Item_Instance_Trait; |
| 7 | |
| 8 | abstract class View_Single_Action implements Repository_Item_Instance_Trait { |
| 9 | |
| 10 | public function rep_item_id() { |
| 11 | return $this->get_slug(); |
| 12 | } |
| 13 | |
| 14 | abstract public function get_slug(): string; |
| 15 | |
| 16 | abstract public function get_label(): string; |
| 17 | |
| 18 | abstract public function show_in_header(): bool; |
| 19 | |
| 20 | abstract public function show_in_row( array $record ): bool; |
| 21 | |
| 22 | public function get_type(): string { |
| 23 | return ''; |
| 24 | } |
| 25 | |
| 26 | public function to_array( array $record ): array { |
| 27 | $attrs = array( |
| 28 | 'value' => $this->get_slug(), |
| 29 | 'label' => $this->get_label(), |
| 30 | ); |
| 31 | |
| 32 | if ( $this->get_type() ) { |
| 33 | $attrs['type'] = $this->get_type(); |
| 34 | } |
| 35 | |
| 36 | return $attrs; |
| 37 | } |
| 38 | |
| 39 | } |
| 40 |