[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/blocks/ -> navigation.php (summary)

Server-side rendering of the `core/navigation` block.

File Size: 711 lines (27 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 14 functions

  block_core_navigation_get_menu_items_at_location()
  block_core_navigation_sort_menu_items_by_parent_id()
  block_core_navigation_parse_blocks_from_menu_items()
  block_core_navigation_build_css_colors()
  block_core_navigation_build_css_font_sizes()
  block_core_navigation_render_submenu_icon()
  block_core_navigation_get_most_recently_published_navigation()
  block_core_navigation_filter_out_empty_blocks()
  block_core_navigation_get_fallback_blocks()
  block_core_navigation_get_post_ids()
  block_core_navigation_from_block_get_post_ids()
  render_block_core_navigation()
  register_block_core_navigation()
  block_core_navigation_typographic_presets_backcompatibility()

Functions
Functions that are not part of a class:

block_core_navigation_get_menu_items_at_location( $location )   X-Ref
Returns the menu items for a WordPress menu location.

return: array Menu items for the location.
param: string $location The menu location.

block_core_navigation_sort_menu_items_by_parent_id( $menu_items )   X-Ref
Sorts a standard array of menu items into a nested structure keyed by the
id of the parent menu.

return: array An array keyed by the id of the parent menu where each element
param: array $menu_items Menu items to sort.

block_core_navigation_parse_blocks_from_menu_items( $menu_items, $menu_items_by_parent_id )   X-Ref
Turns menu item data into a nested array of parsed blocks

return: array An array of parsed block data.
param: array $menu_items               An array of menu items that represent
param: array $menu_items_by_parent_id  An array keyed by the id of the

block_core_navigation_build_css_colors( $attributes )   X-Ref
Build an array with CSS classes and inline styles defining the colors
which will be applied to the navigation markup in the front-end.

return: array Colors CSS classes and inline styles.
param: array $attributes Navigation block attributes.

block_core_navigation_build_css_font_sizes( $attributes )   X-Ref
Build an array with CSS classes and inline styles defining the font sizes
which will be applied to the navigation markup in the front-end.

return: array Font size CSS classes and inline styles.
param: array $attributes Navigation block attributes.

block_core_navigation_render_submenu_icon()   X-Ref
Returns the top-level submenu SVG chevron icon.

return: string

block_core_navigation_get_most_recently_published_navigation()   X-Ref
Finds the most recently published `wp_navigation` Post.

return: WP_Post|null the first non-empty Navigation or null.

block_core_navigation_filter_out_empty_blocks( $parsed_blocks )   X-Ref
Filter out empty "null" blocks from the block list.
'parse_blocks' includes a null block with '\n\n' as the content when
it encounters whitespace. This is not a bug but rather how the parser
is designed.

return: array the normalized parsed blocks.
param: array $parsed_blocks the parsed blocks to be normalized.

block_core_navigation_get_fallback_blocks()   X-Ref
No description

block_core_navigation_get_post_ids( $inner_blocks )   X-Ref
Iterate through all inner blocks recursively and get navigation link block's post IDs.

return: array Array of post IDs.
param: WP_Block_List $inner_blocks Block list class instance.

block_core_navigation_from_block_get_post_ids( $block )   X-Ref
Get post IDs from a navigation link block instance.

return: array Array of post IDs.
param: WP_Block $block Instance of a block.

render_block_core_navigation( $attributes, $content, $block )   X-Ref
Renders the `core/navigation` block on server.

return: string Returns the post content with the legacy widget added.
param: array    $attributes The block attributes.
param: string   $content    The saved content.
param: WP_Block $block      The parsed block.

register_block_core_navigation()   X-Ref
Register the navigation block.


block_core_navigation_typographic_presets_backcompatibility( $parsed_block )   X-Ref
Filter that changes the parsed attribute values of navigation blocks contain typographic presets to contain the values directly.

return: array The block being rendered without typographic presets.
param: array $parsed_block The block being rendered.



Generated : Fri Dec 2 08:20:02 2022 Cross-referenced by PHPXref