Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid generic function names for page list block internal functions #32736

Merged
merged 1 commit into from
Jun 16, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions packages/block-library/src/page-list/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ function block_core_page_list_build_css_font_sizes( $context ) {
*
* @return string List markup.
*/
function render_nested_page_list( $nested_pages, $active_page_ancestor_ids = array() ) {
function block_core_page_list_render_nested_page_list( $nested_pages, $active_page_ancestor_ids = array() ) {
if ( empty( $nested_pages ) ) {
return;
}
Expand All @@ -111,7 +111,7 @@ function render_nested_page_list( $nested_pages, $active_page_ancestor_ids = arr
) . '</a>';
if ( isset( $page['children'] ) ) {
$markup .= '<span class="wp-block-page-list__submenu-icon"><svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="none" role="img" aria-hidden="true" focusable="false"><path d="M1.50002 4L6.00002 8L10.5 4" stroke-width="1.5"></path></svg></span>';
$markup .= '<ul class="submenu-container">' . render_nested_page_list( $page['children'], $active_page_ancestor_ids ) . '</ul>';
$markup .= '<ul class="submenu-container">' . block_core_page_list_render_nested_page_list( $page['children'], $active_page_ancestor_ids ) . '</ul>';
}
$markup .= '</li>';
}
Expand All @@ -126,13 +126,13 @@ function render_nested_page_list( $nested_pages, $active_page_ancestor_ids = arr
*
* @return array The nested array of pages.
*/
function nest_pages( $current_level, $children ) {
function block_core_page_list_nest_pages( $current_level, $children ) {
if ( empty( $current_level ) ) {
return;
}
foreach ( (array) $current_level as $key => $current ) {
if ( isset( $children[ $key ] ) ) {
$current_level[ $key ]['children'] = nest_pages( $children[ $key ], $children );
$current_level[ $key ]['children'] = block_core_page_list_nest_pages( $children[ $key ], $children );
}
}
return $current_level;
Expand Down Expand Up @@ -194,11 +194,11 @@ function render_block_core_page_list( $attributes, $content, $block ) {
}
}

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

$wrapper_markup = '<ul %1$s>%2$s</ul>';

$items_markup = render_nested_page_list( $nested_pages, $active_page_ancestor_ids );
$items_markup = block_core_page_list_render_nested_page_list( $nested_pages, $active_page_ancestor_ids );

$colors = block_core_page_list_build_css_colors( $block->context );
$font_sizes = block_core_page_list_build_css_font_sizes( $block->context );
Expand Down