Asset
1 month ago
Banner
1 month ago
Colors
1 month ago
MenuGroupFactory
1 month ago
MenuPageFactory
1 month ago
Notice
1 month ago
Page
1 month ago
PageFactory
1 month ago
Preference
1 month ago
Type
1 month ago
View
1 month ago
Admin.php
1 month ago
AdminLoader.php
1 month ago
AdminNetwork.php
1 month ago
AdminScripts.php
1 month ago
HelpTab.php
1 month ago
Helpable.php
1 month ago
Menu.php
1 month ago
MenuFactory.php
1 month ago
MenuFactoryInterface.php
1 month ago
MenuGroupFactory.php
1 month ago
MenuListFactory.php
1 month ago
MenuListItems.php
1 month ago
MenuPageFactory.php
1 month ago
PageFactoryInterface.php
1 month ago
PageNetworkRequestHandler.php
1 month ago
PageNetworkRequestHandlers.php
1 month ago
PageRequestHandler.php
1 month ago
PageRequestHandlers.php
1 month ago
RenderableHead.php
1 month ago
RequestHandlerInterface.php
1 month ago
ScreenOption.php
1 month ago
ScreenOptions.php
1 month ago
Scripts.php
1 month ago
Tooltip.php
1 month ago
UninitializedScreens.php
1 month ago
Admin.php
51 lines
| 1 | <?php |
| 2 | |
| 3 | namespace AC\Admin; |
| 4 | |
| 5 | use AC; |
| 6 | use AC\AdminColumns; |
| 7 | use AC\Registerable; |
| 8 | |
| 9 | class Admin implements Registerable |
| 10 | { |
| 11 | |
| 12 | public const NAME = 'codepress-admin-columns'; |
| 13 | |
| 14 | private RequestHandlerInterface $request_handler; |
| 15 | |
| 16 | private AC\Asset\Location $location; |
| 17 | |
| 18 | private AdminScripts $scripts; |
| 19 | |
| 20 | public function __construct(RequestHandlerInterface $request_handler, AdminColumns $plugin, AdminScripts $scripts) |
| 21 | { |
| 22 | $this->request_handler = $request_handler; |
| 23 | $this->location = $plugin->get_location(); |
| 24 | $this->scripts = $scripts; |
| 25 | } |
| 26 | |
| 27 | public function register(): void |
| 28 | { |
| 29 | add_action('admin_menu', [$this, 'init']); |
| 30 | } |
| 31 | |
| 32 | private function get_menu_page_factory(): MenuPageFactory |
| 33 | { |
| 34 | return apply_filters( |
| 35 | 'ac/menu_page_factory', |
| 36 | new MenuPageFactory\SubMenu() |
| 37 | ); |
| 38 | } |
| 39 | |
| 40 | public function init(): void |
| 41 | { |
| 42 | $hook = $this->get_menu_page_factory()->create([ |
| 43 | 'parent' => 'options-general.php', |
| 44 | 'icon' => $this->location->with_suffix('assets/images/page-menu-icon.svg')->get_url(), |
| 45 | ]); |
| 46 | |
| 47 | $loader = new AdminLoader($hook, $this->request_handler, $this->scripts); |
| 48 | $loader->register(); |
| 49 | } |
| 50 | |
| 51 | } |