From d0ceca2496cb9b350b7ff228797284cacac38438 Mon Sep 17 00:00:00 2001 From: azaozz Date: Tue, 4 Oct 2011 17:21:59 +0000 Subject: [PATCH] Make $current_screen->add_option() easier to use, see #18690 git-svn-id: http://svn.automattic.com/wordpress/trunk@18879 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/screen.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/wp-admin/includes/screen.php b/wp-admin/includes/screen.php index 9c85e5c036..324878e598 100644 --- a/wp-admin/includes/screen.php +++ b/wp-admin/includes/screen.php @@ -366,13 +366,16 @@ final class WP_Screen { * @param string $option Option ID * @param mixed $args Associative array of arguments particular to the default $option or the HTML string to be printed in the Screen Options tab. */ - public function add_option( $option = false, $args ) { + public function add_option( $option, $args = null ) { if ( is_array($args) && !empty($option) ) $this->_options[ $option ] = $args; - elseif ( is_string($args) ) - $this->_options['_screen_settings'] .= $args; + elseif ( is_string($option) ) + $this->_options['_screen_settings'] .= $option; + else + return false; $this->_show_options = true; + return true; } /** @@ -413,9 +416,10 @@ final class WP_Screen { // Ensure we have title and ID. if ( ! $args['title'] || ! $args['id'] ) - return; + return false; $this->_help_tabs[] = $args; + return true; } /** @@ -442,7 +446,7 @@ final class WP_Screen { global $_wp_contextual_help; // Intended for adding Help and Screen Options. - do_action('add_screen_help_and_options'); + do_action('add_screen_help_and_options', $this); // Call old contextual_help_list filter. if ( ! isset( $_wp_contextual_help ) )