TableScreen
3 months ago
ColumnTypesFactory.php
3 months ago
ListTable.php
3 months ago
MediaLibraryAssistant.php
3 months ago
TableIdsFactory.php
3 months ago
TableScreen.php
3 months ago
TableScreenFactory.php
3 months ago
WpListTableFactory.php
3 months ago
TableScreenFactory.php
40 lines
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace AC\ThirdParty\MediaLibraryAssistant; |
| 6 | |
| 7 | use AC; |
| 8 | use AC\Type\TableId; |
| 9 | use MLACore; |
| 10 | use WP_Screen; |
| 11 | |
| 12 | class TableScreenFactory implements AC\TableScreenFactory |
| 13 | { |
| 14 | |
| 15 | protected function create_table_screen(): TableScreen |
| 16 | { |
| 17 | return new TableScreen(); |
| 18 | } |
| 19 | |
| 20 | public function create(TableId $id): AC\TableScreen |
| 21 | { |
| 22 | return $this->create_table_screen(); |
| 23 | } |
| 24 | |
| 25 | public function can_create(TableId $id): bool |
| 26 | { |
| 27 | return $id->equals(new TableId('mla-media-assistant')); |
| 28 | } |
| 29 | |
| 30 | public function create_from_wp_screen(WP_Screen $screen): AC\TableScreen |
| 31 | { |
| 32 | return $this->create_table_screen(); |
| 33 | } |
| 34 | |
| 35 | public function can_create_from_wp_screen(WP_Screen $screen): bool |
| 36 | { |
| 37 | return class_exists('MLACore') && 'media_page_' . MLACore::ADMIN_PAGE_SLUG === $screen->id; |
| 38 | } |
| 39 | |
| 40 | } |