Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue/99 #100

Merged
merged 2 commits into from
Apr 9, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 );
}
}
}