TableScreen
2 days ago
ColumnTypesFactory.php
2 days ago
ListTable.php
2 days ago
MediaLibraryAssistant.php
2 days ago
TableIdsFactory.php
2 days ago
TableScreen.php
2 days ago
TableScreenFactory.php
2 days ago
WpListTableFactory.php
2 days 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 | protected function create_table_screen(): TableScreen |
| 15 | { |
| 16 | return new TableScreen(); |
| 17 | } |
| 18 | |
| 19 | public function create(TableId $id): AC\TableScreen |
| 20 | { |
| 21 | return $this->create_table_screen(); |
| 22 | } |
| 23 | |
| 24 | public function can_create(TableId $id): bool |
| 25 | { |
| 26 | return $id->equals(new TableId('mla-media-assistant')); |
| 27 | } |
| 28 | |
| 29 | public function create_from_wp_screen(WP_Screen $screen): AC\TableScreen |
| 30 | { |
| 31 | return $this->create_table_screen(); |
| 32 | } |
| 33 | |
| 34 | public function can_create_from_wp_screen(WP_Screen $screen): bool |
| 35 | { |
| 36 | return class_exists('MLACore') && 'media_page_' . MLACore::ADMIN_PAGE_SLUG === $screen->id; |
| 37 | } |
| 38 | |
| 39 | } |
| 40 |