Skip to content

Commit eaf76ab

Browse files
committed
add exception for all acf options page
1 parent f059631 commit eaf76ab

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

inc/services/acf.php

+11-6
Original file line numberDiff line numberDiff line change
@@ -105,18 +105,22 @@ public function init() {
105105
}
106106

107107
/**
108-
* @param $parameters
108+
* Add Option Page
109109
*
110110
* @return bool
111+
*
112+
* @param $parameters
113+
*
111114
*/
112115
public function acf_add_options_page( $parameters ) {
113-
/**
114-
* Add Option Page
115-
*/
116116
if ( ! function_exists( 'acf_add_options_page' ) ) {
117117
return false;
118118
}
119119

120+
if ( ! isset( $parameters['menu_slug'] ) ) {
121+
throw new InvalidArgumentException( 'You must specify menu slug for ACF options page.' );
122+
}
123+
120124
return acf_add_options_page( $parameters );
121125

122126
}
@@ -150,17 +154,18 @@ public function get_files() {
150154
/**
151155
* Add options Subpage
152156
*
157+
* @return bool
158+
*
153159
* @param $parameters
154160
*
155-
* @return bool
156161
*/
157162
public function acf_add_options_sub_page( $parameters ) {
158163
if ( ! function_exists( 'acf_add_options_sub_page' ) ) {
159164
return false;
160165
}
161166

162167
if ( ! isset( $parameters['menu_slug'] ) ) {
163-
throw new Exception( 'You must specify menu slug for ACF options page.' );
168+
throw new InvalidArgumentException( 'You must specify menu slug for ACF options page.' );
164169
}
165170

166171
return acf_add_options_sub_page( $parameters );

0 commit comments

Comments
 (0)