init(); $this->initHooks(); do_action( ace()->getPrefixedActionHook( 'init_admin_menu_page' ), $this ); } /** * Init **/ protected function init() {} /** * Init hooks **/ protected function initHooks() { add_action( 'admin_menu', array( $this, 'adminMenu' ) ); add_action( 'admin_notices', array( $this, 'optionUpdateMessage' ) ); add_action( 'admin_enqueue_scripts', array( $this, 'adminEnqueueScripts' ) ); } /** * Init hooks * @param string $hook **/ public function adminEnqueueScripts( $hook ) {} function optionUpdateMessage() { if( !empty( $_REQUEST['settings-updated'] ) && isset( $_REQUEST['page'] ) && $_REQUEST['page'] === $this->menuSlug ) echo '

' . __( 'Saved.', 'ace' ) . '

'; } public function adminMenu() { $has_admin_page = apply_filters( ace()->getPrefixedFilterHook( 'init_admin_menu' ), false ); if ( ! $has_admin_page ) { add_theme_page( $this->pageTitle, $this->menuTitle, $this->capability, $this->menuSlug, array( $this, $this->method ) ); } } public function render() { if ( ! is_string( $this->formTemplate ) || '' === $this->formTemplate ) return; include( $this->formTemplate ); } }