Make WordPress Core

Ticket #21488: add_args_to_settings_section_callback.patch

File add_args_to_settings_section_callback.patch, 1.6 KB (added by cfoellmann, 11 years ago)

hand over args to add_settings_section callback function

  • wp-admin/includes/template.php

     
    10581058 * @param string $title Formatted title of the section. Shown as the heading for the section.
    10591059 * @param string $callback Function that echos out any content at the top of the section (between heading and fields).
    10601060 * @param string $page The slug-name of the settings page on which to show the section. Built-in pages include 'general', 'reading', 'writing', 'discussion', 'media', etc. Create your own using add_options_page();
     1061 * @param array $args Additional arguments
    10611062 */
    1062 function add_settings_section($id, $title, $callback, $page) {
     1063function add_settings_section($id, $title, $callback, $page, $args = array()) {
    10631064        global $wp_settings_sections;
    10641065
    10651066        if ( 'misc' == $page ) {
     
    10791080        if ( !isset($wp_settings_sections[$page][$id]) )
    10801081                $wp_settings_sections[$page][$id] = array();
    10811082
    1082         $wp_settings_sections[$page][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback);
     1083        $wp_settings_sections[$page][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback, 'args' => $args);
    10831084}
    10841085
    10851086/**
     
    11511152                        echo "<h3>{$section['title']}</h3>\n";
    11521153
    11531154                if ( $section['callback'] )
    1154                         call_user_func( $section['callback'], $section );
     1155                        call_user_func( $section['callback'], $section['args'], $section );
    11551156
    11561157                if ( ! isset( $wp_settings_fields ) || !isset( $wp_settings_fields[$page] ) || !isset( $wp_settings_fields[$page][$section['id']] ) )
    11571158                        continue;