Docs: Capitalize "ID", when referring to a widget ID or sidebar ID, in a more consistent way.
Follow-up to [48104], [52357], [52361]. See #53399. Built from https://develop.svn.wordpress.org/trunk@52362 git-svn-id: http://core.svn.wordpress.org/trunk@51954 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
cfd6406f8f
commit
d09d194f12
|
@ -226,7 +226,7 @@ function wp_widget_control( $sidebar_args ) {
|
||||||
if ( isset( $sidebar_args['_display'] ) && 'template' === $sidebar_args['_display'] && $widget_number ) {
|
if ( isset( $sidebar_args['_display'] ) && 'template' === $sidebar_args['_display'] && $widget_number ) {
|
||||||
// number == -1 implies a template where id numbers are replaced by a generic '__i__'.
|
// number == -1 implies a template where id numbers are replaced by a generic '__i__'.
|
||||||
$control['params'][0]['number'] = -1;
|
$control['params'][0]['number'] = -1;
|
||||||
// With id_base widget id's are constructed like {$id_base}-{$id_number}.
|
// With id_base widget ID's are constructed like {$id_base}-{$id_number}.
|
||||||
if ( isset( $control['id_base'] ) ) {
|
if ( isset( $control['id_base'] ) ) {
|
||||||
$id_format = $control['id_base'] . '-__i__';
|
$id_format = $control['id_base'] . '-__i__';
|
||||||
}
|
}
|
||||||
|
|
|
@ -219,12 +219,12 @@ class WP_REST_Sidebars_Controller extends WP_REST_Controller {
|
||||||
|
|
||||||
foreach ( $sidebars as $sidebar_id => $widgets ) {
|
foreach ( $sidebars as $sidebar_id => $widgets ) {
|
||||||
foreach ( $widgets as $i => $widget_id ) {
|
foreach ( $widgets as $i => $widget_id ) {
|
||||||
// This automatically removes the passed widget ids from any other sidebars in use.
|
// This automatically removes the passed widget IDs from any other sidebars in use.
|
||||||
if ( $sidebar_id !== $request['id'] && in_array( $widget_id, $request['widgets'], true ) ) {
|
if ( $sidebar_id !== $request['id'] && in_array( $widget_id, $request['widgets'], true ) ) {
|
||||||
unset( $sidebars[ $sidebar_id ][ $i ] );
|
unset( $sidebars[ $sidebar_id ][ $i ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
// This automatically removes omitted widget ids to the inactive sidebar.
|
// This automatically removes omitted widget IDs to the inactive sidebar.
|
||||||
if ( $sidebar_id === $request['id'] && ! in_array( $widget_id, $request['widgets'], true ) ) {
|
if ( $sidebar_id === $request['id'] && ! in_array( $widget_id, $request['widgets'], true ) ) {
|
||||||
$sidebars['wp_inactive_widgets'][] = $widget_id;
|
$sidebars['wp_inactive_widgets'][] = $widget_id;
|
||||||
}
|
}
|
||||||
|
|
|
@ -188,7 +188,7 @@ class WP_REST_Widgets_Controller extends WP_REST_Controller {
|
||||||
*
|
*
|
||||||
* @since 5.9.0
|
* @since 5.9.0
|
||||||
*
|
*
|
||||||
* @param string $sidebar_id The sidebar id.
|
* @param string $sidebar_id The sidebar ID.
|
||||||
* @return bool Whether the sidebar can be read.
|
* @return bool Whether the sidebar can be read.
|
||||||
*/
|
*/
|
||||||
protected function check_read_sidebar_permission( $sidebar_id ) {
|
protected function check_read_sidebar_permission( $sidebar_id ) {
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.9-beta2-52361';
|
$wp_version = '5.9-beta2-52362';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
|
@ -519,7 +519,7 @@ function wp_unregister_sidebar_widget( $id ) {
|
||||||
* @type int $width Width of the fully expanded control form (but try hard to use the default width).
|
* @type int $width Width of the fully expanded control form (but try hard to use the default width).
|
||||||
* Default 250.
|
* Default 250.
|
||||||
* @type int|string $id_base Required for multi-widgets, i.e widgets that allow multiple instances such as the
|
* @type int|string $id_base Required for multi-widgets, i.e widgets that allow multiple instances such as the
|
||||||
* text widget. The widget id will end up looking like `{$id_base}-{$unique_number}`.
|
* text widget. The widget ID will end up looking like `{$id_base}-{$unique_number}`.
|
||||||
* }
|
* }
|
||||||
* @param mixed ...$params Optional additional parameters to pass to the callback function when it's called.
|
* @param mixed ...$params Optional additional parameters to pass to the callback function when it's called.
|
||||||
*/
|
*/
|
||||||
|
@ -1916,8 +1916,8 @@ function wp_parse_widget_id( $id ) {
|
||||||
*
|
*
|
||||||
* @since 5.8.0
|
* @since 5.8.0
|
||||||
*
|
*
|
||||||
* @param string $widget_id The widget id to look for.
|
* @param string $widget_id The widget ID to look for.
|
||||||
* @return string|null The found sidebar's id, or null if it was not found.
|
* @return string|null The found sidebar's ID, or null if it was not found.
|
||||||
*/
|
*/
|
||||||
function wp_find_widgets_sidebar( $widget_id ) {
|
function wp_find_widgets_sidebar( $widget_id ) {
|
||||||
foreach ( wp_get_sidebars_widgets() as $sidebar_id => $widget_ids ) {
|
foreach ( wp_get_sidebars_widgets() as $sidebar_id => $widget_ids ) {
|
||||||
|
@ -1936,8 +1936,8 @@ function wp_find_widgets_sidebar( $widget_id ) {
|
||||||
*
|
*
|
||||||
* @since 5.8.0
|
* @since 5.8.0
|
||||||
*
|
*
|
||||||
* @param string $widget_id The widget id to assign.
|
* @param string $widget_id The widget ID to assign.
|
||||||
* @param string $sidebar_id The sidebar id to assign to. If empty, the widget won't be added to any sidebar.
|
* @param string $sidebar_id The sidebar ID to assign to. If empty, the widget won't be added to any sidebar.
|
||||||
*/
|
*/
|
||||||
function wp_assign_widget_to_sidebar( $widget_id, $sidebar_id ) {
|
function wp_assign_widget_to_sidebar( $widget_id, $sidebar_id ) {
|
||||||
$sidebars = wp_get_sidebars_widgets();
|
$sidebars = wp_get_sidebars_widgets();
|
||||||
|
@ -1946,7 +1946,7 @@ function wp_assign_widget_to_sidebar( $widget_id, $sidebar_id ) {
|
||||||
foreach ( $widgets as $i => $maybe_widget_id ) {
|
foreach ( $widgets as $i => $maybe_widget_id ) {
|
||||||
if ( $widget_id === $maybe_widget_id && $sidebar_id !== $maybe_sidebar_id ) {
|
if ( $widget_id === $maybe_widget_id && $sidebar_id !== $maybe_sidebar_id ) {
|
||||||
unset( $sidebars[ $maybe_sidebar_id ][ $i ] );
|
unset( $sidebars[ $maybe_sidebar_id ][ $i ] );
|
||||||
// We could technically break 2 here, but continue looping in case the id is duplicated.
|
// We could technically break 2 here, but continue looping in case the ID is duplicated.
|
||||||
continue 2;
|
continue 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue