Skip to content

Commit

Permalink
Use the already-existing get_priority method. Re CMB2#1380 and CMB2#1398
Browse files Browse the repository at this point in the history
  • Loading branch information
jtsternberg committed Jan 5, 2021
1 parent 70ee837 commit 94e80d7
Showing 1 changed file with 2 additions and 21 deletions.
23 changes: 2 additions & 21 deletions includes/CMB2_Options_Hookup.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,29 +65,10 @@ public function hooks() {
add_action( 'admin_post_' . $this->option_key, array( $this, 'save_options' ) );

// Optionally network_admin_menu.
$hook = $this->cmb->prop( 'admin_menu_hook' );
$priority = $this->cmb->prop( 'priority', 10 );

switch ( $priority ) {
case 'high':
$priority = 5;
break;
case 'core':
$priority = 10;
break;
case 'default':
$priority = 10;
break;
case 'low':
$priority = 99;
break;
default:
$priority = (int) $priority;
break;
}
$hook = $this->cmb->prop( 'admin_menu_hook' );

// Hook in to add our menu.
add_action( $hook, array( $this, 'options_page_menu_hooks' ), $priority );
add_action( $hook, array( $this, 'options_page_menu_hooks' ), $this->get_priority() );

// If in the network admin, need to use get/update_site_option.
if ( 'network_admin_menu' === $hook ) {
Expand Down

0 comments on commit 94e80d7

Please sign in to comment.