Make $current_screen->add_option() easier to use, see #18690

git-svn-id: https://develop.svn.wordpress.org/trunk@18879 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2011-10-04 17:21:59 +00:00
parent c8cbea1d66
commit fec0286bb3
1 changed files with 9 additions and 5 deletions

View File

@ -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 ) )