Make WordPress Core


Ignore:
Timestamp:
09/04/2012 08:55:20 PM (12 years ago)
Author:
ryan
Message:

Make the callback optional for add_settings_section(). Props lightningspirit. fixes #21630

File:
1 edited

Legend:

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

    r21735 r21742  
    11071107 * @param string $page The slug name of the page whos settings sections you want to output
    11081108 */
    1109 function do_settings_sections($page) {
     1109function do_settings_sections( $page ) {
    11101110    global $wp_settings_sections, $wp_settings_fields;
    11111111
    1112     if ( !isset($wp_settings_sections) || !isset($wp_settings_sections[$page]) )
     1112    if ( ! isset( $wp_settings_sections ) || !isset( $wp_settings_sections[$page] ) )
    11131113        return;
    11141114
     
    11161116        if ( $section['title'] )
    11171117            echo "<h3>{$section['title']}</h3>\n";
    1118         call_user_func($section['callback'], $section);
    1119         if ( !isset($wp_settings_fields) || !isset($wp_settings_fields[$page]) || !isset($wp_settings_fields[$page][$section['id']]) )
     1118       
     1119        if ( $section['callback'] )
     1120            call_user_func( $section['callback'], $section );
     1121       
     1122        if ( ! isset( $wp_settings_fields ) || !isset( $wp_settings_fields[$page] ) || !isset( $wp_settings_fields[$page][$section['id']] ) )
    11201123            continue;
    11211124        echo '<table class="form-table">';
    1122         do_settings_fields($page, $section['id']);
     1125        do_settings_fields( $page, $section['id'] );
    11231126        echo '</table>';
    11241127    }
Note: See TracChangeset for help on using the changeset viewer.