PluginProbe
Gutenberg / 24.1.0
Gutenberg v24.1.0
24.1.0 24.0.0 23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 All 404 releases
← All changes | build/scripts/block-library/page-list.php +17 -28 23.3.0 → 24.1.0 View file →
@@ -4,15 +4,13 @@
4 4 *
5 5 * @package WordPress
6 6 */
7 7
8 -require_once __DIR__ . '/navigation-link/shared/build-css-font-sizes.php';
9 -
10 8 /**
11 9 * Returns the submenu visibility value with backward compatibility
12 10 * for the deprecated openSubmenusOnClick attribute.
13 11 *
14 - * @since 6.9.0
12 + * @since 7.0.0
15 13 *
16 14 * @param array $context Block context from parent Navigation block.
17 15 * @return string The visibility mode: 'hover', 'click', or 'always'.
18 16 */
@@ -37,10 +35,10 @@
37 35 * which will be applied to the pages markup in the front-end when it is a descendant of navigation.
38 36 *
39 37 * @since 5.8.0
40 38 *
41 - * @param array $attributes Block attributes.
42 - * @param array $context Navigation block context.
39 + * @param array $attributes Block attributes.
40 + * @param array $context Navigation block context.
43 41 * @return array Colors CSS classes and inline styles.
44 42 */
45 43 function gutenberg_block_core_page_list_build_css_colors( $attributes, $context ) {
46 44 $colors = array(
@@ -129,16 +127,16 @@
129 127 * Outputs Page list markup from an array of pages with nested children.
130 128 *
131 129 * @since 5.8.0
132 130 *
133 - * @param string $submenu_visibility The submenu visibility mode: 'hover', 'click', or 'always'.
134 - * @param boolean $show_submenu_icons Whether to show submenu indicator icons.
135 - * @param boolean $is_navigation_child If block is a child of Navigation block.
136 - * @param array $nested_pages The array of nested pages.
137 - * @param boolean $is_nested Whether the submenu is nested or not.
131 + * @param string $submenu_visibility The submenu visibility mode: 'hover', 'click', or 'always'.
132 + * @param boolean $show_submenu_icons Whether to show submenu indicator icons.
133 + * @param boolean $is_navigation_child If block is a child of Navigation block.
134 + * @param array $nested_pages The array of nested pages.
135 + * @param boolean $is_nested Whether the submenu is nested or not.
138 136 * @param array $active_page_ancestor_ids An array of ancestor ids for active page.
139 - * @param array $colors Color information for overlay styles.
140 - * @param integer $depth The nesting depth.
137 + * @param array $colors Color information for overlay styles.
138 + * @param integer $depth The nesting depth.
141 139 *
142 140 * @return string List markup.
143 141 */
144 142 function gutenberg_block_core_page_list_render_nested_page_list( $submenu_visibility, $show_submenu_icons, $is_navigation_child, $nested_pages, $is_nested, $active_page_ancestor_ids = array(), $colors = array(), $depth = 0 ) {
@@ -228,9 +226,9 @@
228 226 *
229 227 * @since 5.8.0
230 228 *
231 229 * @param array $current_level The level being iterated through.
232 - * @param array $children The children grouped by parent post ID.
230 + * @param array $children The children grouped by parent post ID.
233 231 *
234 232 * @return array The nested array of pages.
235 233 */
236 234 function gutenberg_block_core_page_list_nest_pages( $current_level, $children ) {
@@ -259,10 +257,11 @@
259 257 function gutenberg_render_block_core_page_list( $attributes, $content, $block ) {
260 258 static $block_id = 0;
261 259 ++$block_id;
262 260
263 - $parent_page_id = $attributes['parentPageID'];
264 - $is_nested = $attributes['isNested'];
261 + $parent_page_id_attr = $attributes['parentPageID'] ?? null;
262 + $parent_page_id = is_scalar( $parent_page_id_attr ) ? (int) $parent_page_id_attr : 0;
263 + $is_nested = ! empty( $block->context['core/isInsideSubmenu'] );
265 264
266 265 $all_pages = get_pages(
267 266 array(
268 267 'sort_column' => 'menu_order,post_title',
@@ -305,24 +304,14 @@
305 304
306 305 }
307 306 }
308 307
309 - $colors = gutenberg_block_core_page_list_build_css_colors( $attributes, $block->context );
310 - // The build system prefixes this function with "gutenberg_" to avoid
311 - // collisions with the core version. Until this function is backported to
312 - // core, we need to guard its use and only call the prefixed name in
313 - // the plugin.
314 - if ( defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN ) {
315 - $font_sizes = gutenberg_block_core_shared_navigation_build_css_font_sizes( $block->context );
316 - } else {
317 - $font_sizes = block_core_shared_navigation_build_css_font_sizes( $block->context );
318 - }
308 + $colors = gutenberg_block_core_page_list_build_css_colors( $attributes, $block->context );
319 309 $classes = array_merge(
320 - $colors['css_classes'],
321 - $font_sizes['css_classes']
310 + $colors['css_classes']
322 311 );
323 312
324 - $style_attribute = ( $colors['inline_styles'] . $font_sizes['inline_styles'] );
313 + $style_attribute = $colors['inline_styles'];
325 314 $css_classes = trim( implode( ' ', $classes ) );
326 315
327 316 $nested_pages = gutenberg_block_core_page_list_nest_pages( $top_level_pages, $pages_with_children );
328 317