Added help page, made multi-level menu

This commit is contained in:
Paul Kirby 2020-02-17 16:40:51 -06:00
parent d6a3e21f32
commit be64d7a523
2 changed files with 33 additions and 3 deletions

View file

@ -14,7 +14,7 @@ class LBRY_Admin
*/ */
public function __construct() public function __construct()
{ {
add_action('admin_menu', array($this, 'create_options_page')); add_action('admin_menu', array($this, 'create_menu_pages'));
add_action('admin_init', array($this, 'page_init')); add_action('admin_init', array($this, 'page_init'));
add_action('admin_init', array($this, 'wallet_balance_warning')); add_action('admin_init', array($this, 'wallet_balance_warning'));
add_action('admin_post_lbry_add_channel', array($this, 'add_channel')); add_action('admin_post_lbry_add_channel', array($this, 'add_channel'));
@ -23,16 +23,34 @@ class LBRY_Admin
/** /**
* Creates the options page in the WP admin interface * Creates the options page in the WP admin interface
*/ */
public function create_options_page() public function create_menu_pages()
{ {
add_menu_page( add_menu_page(
__('LBRYPress Settings', 'lbrypress'), __('LBRYPress Settings', 'lbrypress'),
__('LBRYPress', 'lbrypress'), __('LBRYPress', 'lbrypress'),
'manage_options', 'manage_options',
LBRY_ADMIN_PAGE, LBRY_ADMIN_PAGE,
array($this, 'options_page_html'), '',
plugin_dir_url(LBRY_PLUGIN_FILE) . '/admin/images/lbry-logo.svg' plugin_dir_url(LBRY_PLUGIN_FILE) . '/admin/images/lbry-logo.svg'
); );
add_submenu_page(
LBRY_ADMIN_PAGE,
__('LBRYPress Settings', 'lbrypress'),
__('Settings', 'lbrypress'),
'manage_options',
LBRY_ADMIN_PAGE,
array($this, 'options_page_html')
);
add_submenu_page(
LBRY_ADMIN_PAGE,
__('LBRYPress Help', 'lbrypress'),
__('Help', 'lbrypress'),
'manage_options',
'lbrypress-help',
array($this, 'help_page_html')
);
} }
/** /**
@ -111,6 +129,14 @@ class LBRY_Admin
require_once(LBRY_ABSPATH . 'templates/options_page.php'); require_once(LBRY_ABSPATH . 'templates/options_page.php');
} }
/**
* Returns the Help Page HTML for the plugin
*/
public function help_page_html()
{
require_once(LBRY_ABSPATH . 'templates/help_page.php');
}
/** /**
* Sanitizes setting input * Sanitizes setting input
* // COMBAK Potentially sanitize more * // COMBAK Potentially sanitize more

4
templates/help_page.php Normal file
View file

@ -0,0 +1,4 @@
<div class="wrap">
<h1><?= esc_html(get_admin_page_title()); ?></h1>
<h2>Help!</h2>
</div>