Make WordPress Core


Ignore:
Timestamp:
10/04/2011 05:21:59 PM (15 years ago)
Author:
azaozz
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/screen.php

    r18874 r18879  
    367367         * @param mixed $args Associative array of arguments particular to the default $option or the HTML string to be printed in the Screen Options tab.
    368368         */
    369         public function add_option( $option = false, $args ) {
     369        public function add_option( $option, $args = null ) {
    370370                if ( is_array($args) && !empty($option) )
    371371                        $this->_options[ $option ] = $args;
    372                 elseif ( is_string($args) )
    373                         $this->_options['_screen_settings'] .= $args;
     372                elseif ( is_string($option) )
     373                        $this->_options['_screen_settings'] .= $option;
     374                else
     375                        return false;
    374376
    375377                $this->_show_options = true;
     378                return true;
    376379        }
    377380       
     
    414417                // Ensure we have title and ID.
    415418                if ( ! $args['title'] || ! $args['id'] )
    416                         return;
     419                        return false;
    417420
    418421                $this->_help_tabs[] = $args;
     422                return true;
    419423        }
    420424
     
    443447
    444448                // Intended for adding Help and Screen Options.
    445                 do_action('add_screen_help_and_options');
     449                do_action('add_screen_help_and_options', $this);
    446450
    447451                // Call old contextual_help_list filter.
Note: See TracChangeset for help on using the changeset viewer.