WordPress.org

Make WordPress Core

Ticket #10556: template.patch

File template.patch, 863 bytes (added by sudar, 6 years ago)

patch for checked function

  • template.php

     
    415415 * @param string $type The type of checked|selected we are doing. 
    416416 */ 
    417417function __checked_selected_helper( $helper, $current, $echo, $type) { 
    418         if ( (string) $helper === (string) $current) 
    419                 $result = " $type='$type'"; 
    420         else 
    421                 $result = ''; 
    422  
     418    // If the value to compare is an array, then check whether it is present in the array 
     419    if (is_array($helper)) { 
     420        if (in_array($helper, $current)) 
     421            $result = " $type='$type'"; 
     422        else 
     423            $result = ''; 
     424    } else { 
     425        if ( (string) $helper === (string) $current) 
     426            $result = " $type='$type'"; 
     427        else 
     428            $result = ''; 
     429    } 
    423430        if ($echo) 
    424431                echo $result; 
    425432