-
Notifications
You must be signed in to change notification settings - Fork 24
Open
Description
Currently we can add a submenu option page.
Desired Outcome
I'm trying to add the plugin page with no parent.
I tried with the settings but realized the Class is not implemented to do this.
I tried to extend the Class but I can't seem to manage to have both the menu where I want and the content in it...
namespace TDP;
require_once( 'vendor/autoload.php' );
$prefix = 'aaa';
Class MyOptionKit extends OptionsKit
{
// I tried with and without __construct()
// public function __construct( $slug = false ) {
// parent::__construct();
// }
// I tried with and without hooks()
// private function hooks() {
// add_action( 'admin_menu', array( $this, 'add_settings_page' ), apply_filters( $this->func . '_admin_menu_priority', 10 ) );
// add_filter( 'admin_body_class', array( $this, 'admin_body_class' ) );
// add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 100 );
// add_action( 'rest_api_init', array( $this, 'register_rest_controller' ) );
// }
public function add_settings_page() {
add_menu_page(
'AAA', // page <title>Title</title>
'AAA', // link text
'manage_options', // user capabilities
'aaa-settings', // I used a string slug because with the original $this->slug . '-settings', the menu did not show up at all
array( $this, 'render_settings_page' ),
'dashicons-superhero', // icon (from Dashicons for example)
55.4 // menu position
);
}
// I tried loading functions from Class when using hooks()
// public function enqueue_scripts(){
// parent::enqueue_scripts();
// }
// public function admin_body_class(){
// parent::admin_body_class();
// }
// public function register_rest_controller() {
// parent::register_rest_controller();
// }
Metadata
Metadata
Assignees
Labels
No labels