| @@ 16-27 (lines=12) @@ | ||
| 13 | \add_action('admin_menu', array($this,'add_menu_page')); |
|
| 14 | } |
|
| 15 | ||
| 16 | public function add_menu_page() |
|
| 17 | { |
|
| 18 | \add_menu_page( |
|
| 19 | $this->config['title'], |
|
| 20 | $this->config['menu_title'], |
|
| 21 | $this->config['capability'], |
|
| 22 | $this->config['slug'], |
|
| 23 | null, // Create a child page with the parent_slug set to this page's slug |
|
| 24 | $this->config['icon'], |
|
| 25 | $this->config['position'] |
|
| 26 | ); |
|
| 27 | } |
|
| 28 | ||
| 29 | private function default_args() |
|
| 30 | { |
|
| @@ 39-49 (lines=11) @@ | ||
| 36 | /** |
|
| 37 | * Internally used to add a submenu page for this child page |
|
| 38 | */ |
|
| 39 | public function add_submenu_page() |
|
| 40 | { |
|
| 41 | \add_submenu_page( |
|
| 42 | $this->config['parent_slug'], |
|
| 43 | $this->config['title'], |
|
| 44 | $this->config['menu_title'], |
|
| 45 | $this->config['capability'], |
|
| 46 | $this->config['slug'], |
|
| 47 | array($this, 'render') |
|
| 48 | ); |
|
| 49 | } |
|
| 50 | ||
| 51 | /** |
|
| 52 | * Conditionally enqueue settings scripts and styles if the calling page is |
|