Ticket #21488: add_args_to_settings_section_callback.patch
File add_args_to_settings_section_callback.patch, 1.6 KB (added by , 11 years ago) |
---|
-
wp-admin/includes/template.php
1058 1058 * @param string $title Formatted title of the section. Shown as the heading for the section. 1059 1059 * @param string $callback Function that echos out any content at the top of the section (between heading and fields). 1060 1060 * @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 1061 1062 */ 1062 function add_settings_section($id, $title, $callback, $page ) {1063 function add_settings_section($id, $title, $callback, $page, $args = array()) { 1063 1064 global $wp_settings_sections; 1064 1065 1065 1066 if ( 'misc' == $page ) { … … 1079 1080 if ( !isset($wp_settings_sections[$page][$id]) ) 1080 1081 $wp_settings_sections[$page][$id] = array(); 1081 1082 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); 1083 1084 } 1084 1085 1085 1086 /** … … 1151 1152 echo "<h3>{$section['title']}</h3>\n"; 1152 1153 1153 1154 if ( $section['callback'] ) 1154 call_user_func( $section['callback'], $section );1155 call_user_func( $section['callback'], $section['args'], $section ); 1155 1156 1156 1157 if ( ! isset( $wp_settings_fields ) || !isset( $wp_settings_fields[$page] ) || !isset( $wp_settings_fields[$page][$section['id']] ) ) 1157 1158 continue;