Skip to content

Commit

Permalink
Removes __unstableMaxPages attribute from Page List block (and Nav bl…
Browse files Browse the repository at this point in the history
…ock) (#44415)

* Removes unstable limit attribute

* Remove attribute from Nav block
  • Loading branch information
getdave authored and ockham committed Oct 10, 2022
1 parent b5c56fb commit c8bc6f5
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 14 deletions.
2 changes: 1 addition & 1 deletion docs/reference-guides/core-blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ Display a list of all pages. ([Source](https://github.com/WordPress/gutenberg/tr
- **Name:** core/page-list
- **Category:** widgets
- **Supports:** ~~html~~, ~~reusable~~
- **Attributes:** __unstableMaxPages
- **Attributes:**

## Paragraph

Expand Down
3 changes: 0 additions & 3 deletions packages/block-library/src/navigation/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -307,9 +307,6 @@ function block_core_navigation_get_fallback_blocks() {
$page_list_fallback = array(
array(
'blockName' => 'core/page-list',
'attrs' => array(
'__unstableMaxPages' => 4,
),
),
);

Expand Down
6 changes: 1 addition & 5 deletions packages/block-library/src/page-list/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@
"description": "Display a list of all pages.",
"keywords": [ "menu", "navigation" ],
"textdomain": "default",
"attributes": {
"__unstableMaxPages": {
"type": "number"
}
},
"attributes": {},
"usesContext": [
"textColor",
"customTextColor",
Expand Down
5 changes: 0 additions & 5 deletions packages/block-library/src/page-list/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -299,11 +299,6 @@ function render_block_core_page_list( $attributes, $content, $block ) {

$nested_pages = block_core_page_list_nest_pages( $top_level_pages, $pages_with_children );

// Limit the number of items to be visually displayed.
if ( ! empty( $attributes['__unstableMaxPages'] ) ) {
$nested_pages = array_slice( $nested_pages, 0, $attributes['__unstableMaxPages'] );
}

$is_navigation_child = array_key_exists( 'showSubmenuIcon', $block->context );

$open_submenus_on_click = array_key_exists( 'openSubmenusOnClick', $block->context ) ? $block->context['openSubmenusOnClick'] : false;
Expand Down

0 comments on commit c8bc6f5

Please sign in to comment.