| @@ -8,9 +8,9 @@ | ||
| 8 | 8 | /** |
| 9 | 9 | * Returns the submenu visibility value with backward compatibility |
| 10 | 10 | * for the deprecated openSubmenusOnClick attribute. |
| 11 | 11 | * |
| 12 | - * @since 6.9.0 | |
| 12 | + * @since 7.0.0 | |
| 13 | 13 | * |
| 14 | 14 | * @param array $context Block context from parent Navigation block. |
| 15 | 15 | * @return string The visibility mode: 'hover', 'click', or 'always'. |
| 16 | 16 | */ |
| @@ -35,10 +35,10 @@ | ||
| 35 | 35 | * which will be applied to the pages markup in the front-end when it is a descendant of navigation. |
| 36 | 36 | * |
| 37 | 37 | * @since 5.8.0 |
| 38 | 38 | * |
| 39 | - * @param array $attributes Block attributes. | |
| 40 | - * @param array $context Navigation block context. | |
| 39 | + * @param array $attributes Block attributes. | |
| 40 | + * @param array $context Navigation block context. | |
| 41 | 41 | * @return array Colors CSS classes and inline styles. |
| 42 | 42 | */ |
| 43 | 43 | function gutenberg_block_core_page_list_build_css_colors( $attributes, $context ) { |
| 44 | 44 | $colors = array( |
| @@ -127,16 +127,16 @@ | ||
| 127 | 127 | * Outputs Page list markup from an array of pages with nested children. |
| 128 | 128 | * |
| 129 | 129 | * @since 5.8.0 |
| 130 | 130 | * |
| 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. | |
| 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. | |
| 136 | 136 | * @param array $active_page_ancestor_ids An array of ancestor ids for active page. |
| 137 | - * @param array $colors Color information for overlay styles. | |
| 138 | - * @param integer $depth The nesting depth. | |
| 137 | + * @param array $colors Color information for overlay styles. | |
| 138 | + * @param integer $depth The nesting depth. | |
| 139 | 139 | * |
| 140 | 140 | * @return string List markup. |
| 141 | 141 | */ |
| 142 | 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 ) { |
| @@ -226,9 +226,9 @@ | ||
| 226 | 226 | * |
| 227 | 227 | * @since 5.8.0 |
| 228 | 228 | * |
| 229 | 229 | * @param array $current_level The level being iterated through. |
| 230 | - * @param array $children The children grouped by parent post ID. | |
| 230 | + * @param array $children The children grouped by parent post ID. | |
| 231 | 231 | * |
| 232 | 232 | * @return array The nested array of pages. |
| 233 | 233 | */ |
| 234 | 234 | function gutenberg_block_core_page_list_nest_pages( $current_level, $children ) { |
| @@ -257,10 +257,11 @@ | ||
| 257 | 257 | function gutenberg_render_block_core_page_list( $attributes, $content, $block ) { |
| 258 | 258 | static $block_id = 0; |
| 259 | 259 | ++$block_id; |
| 260 | 260 | |
| 261 | - $parent_page_id = $attributes['parentPageID']; | |
| 262 | - $is_nested = ! empty( $block->context['core/isInsideSubmenu'] ); | |
| 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'] ); | |
| 263 | 264 | |
| 264 | 265 | $all_pages = get_pages( |
| 265 | 266 | array( |
| 266 | 267 | 'sort_column' => 'menu_order,post_title', |
| @@ -308,9 +309,9 @@ | ||
| 308 | 309 | $classes = array_merge( |
| 309 | 310 | $colors['css_classes'] |
| 310 | 311 | ); |
| 311 | 312 | |
| 312 | - $style_attribute = ( $colors['inline_styles'] ); | |
| 313 | + $style_attribute = $colors['inline_styles']; | |
| 313 | 314 | $css_classes = trim( implode( ' ', $classes ) ); |
| 314 | 315 | |
| 315 | 316 | $nested_pages = gutenberg_block_core_page_list_nest_pages( $top_level_pages, $pages_with_children ); |
| 316 | 317 | |