Changeset 49123 for trunk/src/wp-admin/includes/dashboard.php
- Timestamp:
- 10/10/2020 08:38:49 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/dashboard.php
r49114 r49123 16 16 * @global array $wp_registered_widgets 17 17 * @global array $wp_registered_widget_controls 18 * @global array$wp_dashboard_control_callbacks18 * @global callable[] $wp_dashboard_control_callbacks 19 19 */ 20 20 function wp_dashboard_setup() { … … 158 158 * 159 159 * @since 2.7.0 160 * 161 * @global array $wp_dashboard_control_callbacks 160 * @since 5.6.0 The `$context` and `$priority` parameters were added. 161 * 162 * @global callable[] $wp_dashboard_control_callbacks 162 163 * 163 164 * @param string $widget_id Widget ID (used in the 'id' attribute for the widget). … … 168 169 * @param array $callback_args Optional. Data that should be set as the $args property of the widget array 169 170 * (which is the second parameter passed to your callback). Default null. 170 */ 171 function wp_add_dashboard_widget( $widget_id, $widget_name, $callback, $control_callback = null, $callback_args = null ) { 171 * @param string $context Optional. The context within the screen where the box should display. 172 * Accepts 'normal', 'side', 'column3', or 'column4'. Default 'normal'. 173 * @param string $priority Optional. The priority within the context where the box should show. 174 * Accepts 'high', 'core', 'default', or 'low'. Default 'core'. 175 */ 176 function wp_add_dashboard_widget( $widget_id, $widget_name, $callback, $control_callback = null, $callback_args = null, $context = 'normal', $priority = 'core' ) { 172 177 $screen = get_current_screen(); 173 178 global $wp_dashboard_control_callbacks; … … 195 200 $side_widgets = array( 'dashboard_quick_press', 'dashboard_primary' ); 196 201 197 $location = 'normal';198 202 if ( in_array( $widget_id, $side_widgets, true ) ) { 199 $ location= 'side';203 $context = 'side'; 200 204 } 201 205 202 206 $high_priority_widgets = array( 'dashboard_browser_nag', 'dashboard_php_nag' ); 203 207 204 $priority = 'core';205 208 if ( in_array( $widget_id, $high_priority_widgets, true ) ) { 206 209 $priority = 'high'; 207 210 } 208 211 209 add_meta_box( $widget_id, $widget_name, $callback, $screen, $location, $priority, $callback_args ); 212 if ( empty( $context ) ) { 213 $context = 'normal'; 214 } 215 if ( empty( $priority ) ) { 216 $priority = 'core'; 217 } 218 219 add_meta_box( $widget_id, $widget_name, $callback, $screen, $context, $priority, $callback_args ); 210 220 } 211 221 … … 1140 1150 * @since 2.5.0 1141 1151 * 1142 * @global array$wp_dashboard_control_callbacks1152 * @global callable[] $wp_dashboard_control_callbacks 1143 1153 * 1144 1154 * @param int $widget_control_id Registered Widget ID.
Note: See TracChangeset
for help on using the changeset viewer.