diff --git a/inc/services/acf.php b/inc/services/acf.php index 8bd2841d..ae186c77 100644 --- a/inc/services/acf.php +++ b/inc/services/acf.php @@ -94,6 +94,7 @@ public function init() { * * $this->acf_add_options_page( [ * 'page_title' => __( 'Theme Options', 'framework-textdomain' ), + * 'menu_slug' => 'theme-options', * 'parent_slug' => 'themes.php', * ] ); * @@ -104,18 +105,22 @@ public function init() { } /** - * @param $parameters + * Add Option Page * * @return bool + * + * @param $parameters + * */ public function acf_add_options_page( $parameters ) { - /** - * Add Option Page - */ if ( ! function_exists( 'acf_add_options_page' ) ) { return false; } + if ( ! isset( $parameters['menu_slug'] ) ) { + throw new InvalidArgumentException( 'You must specify menu slug for ACF options page.' ); + } + return acf_add_options_page( $parameters ); } @@ -147,18 +152,22 @@ public function get_files() { } /** - * @param $parameters + * Add options Subpage * * @return bool + * + * @param $parameters + * */ public function acf_add_options_sub_page( $parameters ) { - /** - * Add Option Subpage - */ if ( ! function_exists( 'acf_add_options_sub_page' ) ) { return false; } + if ( ! isset( $parameters['menu_slug'] ) ) { + throw new InvalidArgumentException( 'You must specify menu slug for ACF options page.' ); + } + return acf_add_options_sub_page( $parameters ); } -} \ No newline at end of file +}