Skip to content

Commit

Permalink
Merge pull request #100 from BeAPI/issue/99
Browse files Browse the repository at this point in the history
Issue/99
  • Loading branch information
asadowski10 authored Apr 9, 2020
2 parents 276bbd6 + eaf76ab commit 27c0d69
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions inc/services/acf.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
* ] );
*
Expand All @@ -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 );

}
Expand Down Expand Up @@ -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 );
}
}
}

0 comments on commit 27c0d69

Please sign in to comment.