Adding 'other' template page for admin panel

This commit is contained in:
Brian 2021-10-06 12:43:06 -06:00
parent 85f7d28a0f
commit bcb3b06bc3
Signed by: brian
GPG Key ID: DE1A5390A3B84CD8
2 changed files with 26 additions and 4 deletions

View File

@ -53,11 +53,11 @@ class AdminSettings {
*/
public function add_submenu_items(): void {
$parent_menu_slug = 'nmsp-plugin-name-menu-slug';
$page_title = __( 'Namespace Plugin Name - Settings', 'nmsp_plugin_name_settings_title' );
$menu_title = __( 'Settings', 'nmsp_plugin_name_settings_title' );
$menu_slug = $parent_menu_slug;
$page_title = __( 'Namespace Plugin Name - Other', 'nmsp_plugin_name_settings_title' );
$menu_title = __( 'Other', 'nmsp_plugin_name_settings_title' );
$menu_slug = 'nmsp-plugin-name-menu-other-slug';
$capability = 'manage_options';
$callback = '';
$callback = array( $this, 'show_other_page' );
add_submenu_page( $parent_menu_slug, $page_title, $menu_title, $capability, $menu_slug, $callback );
}
@ -79,6 +79,23 @@ class AdminSettings {
echo wp_kses_post( $output );
}
/**
* Show the "other" page.
*
* @since 1.0.0
*
* @return void
*/
public function show_other_page(): void {
$data = array();
$this->localize_script();
ob_start();
echo nmsp_plugin_app()->blade->run( 'admin.other', $data );
$output = ob_get_clean();
echo wp_kses_post( $output );
}
/**
* Register and enqueue stylesheets and javascript files.
*

View File

@ -0,0 +1,5 @@
@extends('layouts.admin')
@section('content')
<p>PluginNamespace Plugin {{ __( 'Admin Other Page', 'nmsp-plugin-name-text-domain' ) }}</p>
@endsection