settings_api = new Settings_API; $this->settings_prefix = 'elementor_extras_'; // actions add_action( 'admin_menu', [ $this, 'menu' ], 200 ); add_action( 'admin_init', [ $this, 'init' ] ); add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_scripts' ], 0 ); add_action( 'admin_notices', [ $this, 'render_notices' ] ); } /** * Adds the item to the menu * * @since 1.8.0 * * @access public */ public function menu() {} /** * Enqueue styles and scripts * * @since 1.8.0 * * @access public */ public function enqueue_scripts() { } /** * Hooked into admin_init action * * @since 1.8.0 * * @access public */ public function init() { $this->settings_api->set_sections( $this->get_settings_sections() ); $this->settings_api->set_fields( $this->get_settings_fields() ); $this->settings_api->admin_init(); $this->maybe_remove_notices(); } /** * Gets the settings sections * * @since 1.8.0 * * @access public */ public function get_settings_sections() { return []; } /** * Gets the settings fields * * @since 1.8.0 * * @access public */ public function get_settings_fields() { return []; } /** * Get tabs to be displayed on page * * @since 1.8.0 * * @access public */ public final function get_page_tabs() { $this->set_page_tabs(); return $this->page_tabs; } /** * Sets the tabs variable * * @since 1.8.0 * * @access protected */ private function set_page_tabs() { if ( null === $this->page_tabs ) { $this->page_tabs = $this->create_page_tabs(); } } /** * Creates the tabs object * * @since 1.8.0 * * @access protected */ abstract protected function create_page_tabs(); /** * Returns current page title * * @since 1.8.0 * * @access protected */ abstract protected function get_page_title(); /** * Renders the page * * @since 1.8.0 * * @access public */ public function render_page() { $tabs = $this->get_page_tabs(); ?>