Class: \Conifer\Admin\Page (abstract)
Class for abstracting WP Admin pages
Example
```php
use Conifer\Admin\Page as AdminPage;
class MySettingsPage extends AdminPage {
public function render() : string {
return '<h1>ALL THE SETTINGS</h1> ...';
}
}
$settingsPage = new MySettingsPage('My Theme Settings');
$settingsPage->add();
```
Visibility | Function |
---|---|
public | __construct(\string $title, \string $menuTitle='' , \string $capability='manage_options' , \string $slug='' , \string $iconUrl='' )</strong> : voidConstructor Defaults to $title Defaults to "manage_options" . Defaults to the sanitized $menuTitle . |
public | add() : Page returns this Page Add this Admin Page to the admin main menu |
public | add_sub_page(\string $class, \string $title, \string $menuTitle='' , \string $capability='' , \string $slug='' )</strong> : Page returns this Page.Add a sub-menu admin page to this Page. represent the new sub-page. Defaults to $title . Defaults to the required capability for this Page. Defaults to the sanitized $menuTitle . |
public | do_add() : Page returns this Page The callback to the admin_menu action. |
public | get_capability() : string Get the capability to be passed to WP when this Page is added. |
public | get_icon_url() : string Get the icon_url to be passed to WP when this Page is added. |
public | get_menu_title() : string Get the menu_title to be passed to WP when this Page is added. |
public | get_slug() : string Get the menu_slug to be passed to WP when this Page is added. When adding sub-pages, this is what is passed as parent_slug |
public | get_title() : string Get the page_title to be passed to WP when this Page is added. |
public | abstract render() : string Render the content of this admin Page. |
public | set_capability(\string $capability)</strong> : Page returns this Page object Set the capability required to view this Admin Page. |
public | set_icon_url(\string $url)</strong> : Page returns this Page object Set the icon_url for this Admin Page. Admin Page. |
public | set_menu_title(\string $menuTitle)</strong> : Page returns this Page object Set the menu_title for this Admin Page. |
public | set_slug(\string $slug)</strong> : Page returns this Page object Set the slug for this Admin Page. |
public | set_title(\string $title)</strong> : Page returns this Page object Set the title for this Admin Page. |