From eaf76ab3ce1f07939c4b675788dbd56432c98a6f Mon Sep 17 00:00:00 2001 From: Amaury Balmer Date: Tue, 31 Mar 2020 13:07:22 +0200 Subject: [PATCH] add exception for all acf options page --- inc/services/acf.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/inc/services/acf.php b/inc/services/acf.php index f9b5ec35..ae186c77 100644 --- a/inc/services/acf.php +++ b/inc/services/acf.php @@ -105,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 ); } @@ -150,9 +154,10 @@ public function get_files() { /** * Add options Subpage * + * @return bool + * * @param $parameters * - * @return bool */ public function acf_add_options_sub_page( $parameters ) { if ( ! function_exists( 'acf_add_options_sub_page' ) ) { @@ -160,7 +165,7 @@ public function acf_add_options_sub_page( $parameters ) { } if ( ! isset( $parameters['menu_slug'] ) ) { - throw new Exception( 'You must specify menu slug for ACF options page.' ); + throw new InvalidArgumentException( 'You must specify menu slug for ACF options page.' ); } return acf_add_options_sub_page( $parameters );