__checked_selected_helper

Private helper function for checked, selected, and disabled.

Description

(string) __checked_selected_helper( (mixed) $helper, (mixed) $current, (bool) $echo, (string) $type ); 

Compares the first two arguments and if identical marks as $type

Returns (string)

html attribute or empty string

Parameters (4)

0. $helper (mixed)
One of the values to compare
1. $current (mixed)
(true) The other value to compare if not just true
2. $echo (bool)
Whether to echo or just return the string
3. $type (string)
The type of checked|selected|disabled we are doing

Usage

  1. if ( !function_exists( '__checked_selected_helper' ) ) { 
  2. require_once ABSPATH . WPINC . '/general-template.php'; 
  3.  
  4. // One of the values to compare 
  5. $helper = null; 
  6.  
  7. // (true) The other value to compare if not just true 
  8. $current = null; 
  9.  
  10. // Whether to echo or just return the string 
  11. $echo = true; 
  12.  
  13. // The type of checked|selected|disabled we are doing 
  14. $type = ''; 
  15.  
  16. // NOTICE! Understand what this does before running. 
  17. $result = __checked_selected_helper($helper, $current, $echo, $type); 
  18.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/general-template.php  
  1. function __checked_selected_helper( $helper, $current, $echo, $type ) { 
  2. if ( (string) $helper === (string) $current ) 
  3. $result = " $type='$type'"; 
  4. else 
  5. $result = ''; 
  6.  
  7. if ( $echo ) 
  8. echo $result; 
  9.  
  10. return $result;