AdminNetwork.php
1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
namespace AC\Admin;
use AC\Asset\Location\Absolute;
use AC\Registerable;
class AdminNetwork implements Registerable {
/**
* @var RequestHandlerInterface
*/
private $request_handler;
/**
* @var Absolute
*/
private $location_core;
/**
* @var AdminScripts
*/
private $scripts;
public function __construct( RequestHandlerInterface $request_handler, Absolute $location_core, AdminScripts $scripts ) {
$this->request_handler = $request_handler;
$this->location_core = $location_core;
$this->scripts = $scripts;
}
public function register() {
add_action( 'network_admin_menu', [ $this, 'init' ] );
}
private function get_menu_page_factory() {
return apply_filters(
'acp/menu_network_page_factory',
new MenuPageFactory\SubMenu()
);
}
public function init() {
$hook = $this->get_menu_page_factory()->create( [
'parent' => 'settings.php',
'icon' => $this->location_core->with_suffix( 'assets/images/page-menu-icon.svg' )->get_url(),
] );
$loader = new AdminLoader( $hook, $this->request_handler, $this->scripts );
$loader->register();
}
}