Changeset 58187 for trunk/src/wp-includes/blocks/navigation.php
- Timestamp:
- 05/23/2024 07:37:08 PM (9 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/blocks/navigation.php
r57888 r58187 8 8 /** 9 9 * Helper functions used to render the navigation block. 10 * 11 * @since 6.5.0 10 12 */ 11 13 class WP_Navigation_Block_Renderer { … … 13 15 /** 14 16 * Used to determine whether or not a navigation has submenus. 17 * 18 * @since 6.5.0 15 19 */ 16 20 private static $has_submenus = false; … … 18 22 /** 19 23 * Used to determine which blocks need an <li> wrapper. 24 * 25 * @since 6.5.0 20 26 * 21 27 * @var array … … 24 30 'core/site-title', 25 31 'core/site-logo', 32 'core/social-links', 26 33 ); 27 34 … … 29 36 * Keeps track of all the navigation names that have been seen. 30 37 * 38 * @since 6.5.0 39 * 31 40 * @var array 32 41 */ … … 35 44 /** 36 45 * Returns whether or not this is responsive navigation. 46 * 47 * @since 6.5.0 37 48 * 38 49 * @param array $attributes The block attributes. … … 50 61 /** 51 62 * Returns whether or not a navigation has a submenu. 63 * 64 * @since 6.5.0 52 65 * 53 66 * @param WP_Block_List $inner_blocks The list of inner blocks. … … 88 101 * Determine whether the navigation blocks is interactive. 89 102 * 103 * @since 6.5.0 104 * 90 105 * @param array $attributes The block attributes. 91 106 * @param WP_Block_List $inner_blocks The list of inner blocks. … … 100 115 /** 101 116 * Returns whether or not a block needs a list item wrapper. 117 * 118 * @since 6.5.0 102 119 * 103 120 * @param WP_Block $block The block. … … 127 144 * Returns the markup for a single inner block. 128 145 * 146 * @since 6.5.0 147 * 129 148 * @param WP_Block $inner_block The inner block. 130 149 * @return string Returns the markup for a single inner block. … … 143 162 /** 144 163 * Returns the html for the inner blocks of the navigation block. 164 * 165 * @since 6.5.0 145 166 * 146 167 * @param array $attributes The block attributes. … … 201 222 * Gets the inner blocks for the navigation block from the navigation post. 202 223 * 224 * @since 6.5.0 225 * 203 226 * @param array $attributes The block attributes. 204 227 * @return WP_Block_List Returns the inner blocks for the navigation block. … … 236 259 * Gets the inner blocks for the navigation block from the fallback. 237 260 * 261 * @since 6.5.0 262 * 238 263 * @param array $attributes The block attributes. 239 264 * @return WP_Block_List Returns the inner blocks for the navigation block. … … 252 277 /** 253 278 * Gets the inner blocks for the navigation block. 279 * 280 * @since 6.5.0 254 281 * 255 282 * @param array $attributes The block attributes. … … 311 338 * Gets the name of the current navigation, if it has one. 312 339 * 340 * @since 6.5.0 341 * 313 342 * @param array $attributes The block attributes. 314 343 * @return string Returns the name of the navigation. … … 346 375 * Returns the layout class for the navigation block. 347 376 * 377 * @since 6.5.0 378 * 348 379 * @param array $attributes The block attributes. 349 380 * @return string Returns the layout class for the navigation block. … … 376 407 /** 377 408 * Return classes for the navigation block. 409 * 410 * @since 6.5.0 378 411 * 379 412 * @param array $attributes The block attributes. … … 404 437 * Get styles for the navigation block. 405 438 * 439 * @since 6.5.0 440 * 406 441 * @param array $attributes The block attributes. 407 442 * @return string Returns the styles for the navigation block. … … 416 451 /** 417 452 * Get the responsive container markup 453 * 454 * @since 6.5.0 418 455 * 419 456 * @param array $attributes The block attributes. … … 515 552 * Get the wrapper attributes 516 553 * 554 * @since 6.5.0 555 * 517 556 * @param array $attributes The block attributes. 518 557 * @param WP_Block_List $inner_blocks A list of inner blocks. … … 543 582 /** 544 583 * Gets the nav element directives. 584 * 585 * @since 6.5.0 545 586 * 546 587 * @param bool $is_interactive Whether the block is interactive. … … 574 615 * Handle view script module loading. 575 616 * 617 * @since 6.5.0 618 * 576 619 * @param array $attributes The block attributes. 577 620 * @param WP_Block $block The parsed block. … … 598 641 * Returns the markup for the navigation block. 599 642 * 643 * @since 6.5.0 644 * 600 645 * @param array $attributes The block attributes. 601 646 * @param WP_Block_List $inner_blocks The list of inner blocks. … … 612 657 /** 613 658 * Returns a unique name for the navigation. 659 * 660 * @since 6.5.0 614 661 * 615 662 * @param array $attributes The block attributes. … … 631 678 /** 632 679 * Renders the navigation block. 680 * 681 * @since 6.5.0 633 682 * 634 683 * @param array $attributes The block attributes. … … 677 726 * Returns the menu items for a WordPress menu location. 678 727 * 728 * @since 5.9.0 729 * 679 730 * @param string $location The menu location. 680 731 * @return array Menu items for the location. … … 713 764 * id of the parent menu. 714 765 * 766 * @since 5.9.0 767 * 715 768 * @param array $menu_items Menu items to sort. 716 769 * @return array An array keyed by the id of the parent menu where each element … … 735 788 * Gets the inner blocks for the navigation block from the unstable location attribute. 736 789 * 790 * @since 6.5.0 791 * 737 792 * @param array $attributes The block attributes. 738 793 * @return WP_Block_List Returns the inner blocks for the navigation block. … … 753 808 * Add Interactivity API directives to the navigation-submenu and page-list 754 809 * blocks markup using the Tag Processor. 810 * 811 * @since 6.3.0 755 812 * 756 813 * @param WP_HTML_Tag_Processor $tags Markup of the navigation block. … … 815 872 * which will be applied to the navigation markup in the front-end. 816 873 * 874 * @since 5.9.0 875 * 817 876 * @param array $attributes Navigation block attributes. 818 877 * … … 906 965 * which will be applied to the navigation markup in the front-end. 907 966 * 967 * @since 5.9.0 968 * 908 969 * @param array $attributes Navigation block attributes. 909 970 * … … 934 995 * Returns the top-level submenu SVG chevron icon. 935 996 * 997 * @since 5.9.0 998 * 936 999 * @return string 937 1000 */ … … 945 1008 * it encounters whitespace. This is not a bug but rather how the parser 946 1009 * is designed. 1010 * 1011 * @since 5.9.0 947 1012 * 948 1013 * @param array $parsed_blocks the parsed blocks to be normalized. … … 964 1029 * Returns true if the navigation block contains a nested navigation block. 965 1030 * 1031 * @since 6.2.0 1032 * 966 1033 * @param WP_Block_List $inner_blocks Inner block instance to be normalized. 967 1034 * @return bool true if the navigation block contains a nested navigation block. … … 986 1053 * This aims to mirror how the fallback mechanic for wp_nav_menu works. 987 1054 * See https://developer.wordpress.org/reference/functions/wp_nav_menu/#more-information. 1055 * 1056 * @since 5.9.0 988 1057 * 989 1058 * @return array the array of blocks to be used as a fallback. … … 1042 1111 * Iterate through all inner blocks recursively and get navigation link block's post IDs. 1043 1112 * 1113 * @since 6.0.0 1114 * 1044 1115 * @param WP_Block_List $inner_blocks Block list class instance. 1045 1116 * … … 1054 1125 * Get post IDs from a navigation link block instance. 1055 1126 * 1127 * @since 6.0.0 1128 * 1056 1129 * @param WP_Block $block Instance of a block. 1057 1130 * … … 1077 1150 * Renders the `core/navigation` block on server. 1078 1151 * 1152 * @since 5.9.0 1153 * 1079 1154 * @param array $attributes The block attributes. 1080 1155 * @param string $content The saved content. … … 1089 1164 /** 1090 1165 * Register the navigation block. 1166 * 1167 * @since 5.9.0 1091 1168 * 1092 1169 * @uses render_block_core_navigation() … … 1106 1183 /** 1107 1184 * Filter that changes the parsed attribute values of navigation blocks contain typographic presets to contain the values directly. 1185 * 1186 * @since 5.9.0 1108 1187 * 1109 1188 * @param array $parsed_block The block being rendered. … … 1141 1220 * Turns menu item data into a nested array of parsed blocks 1142 1221 * 1222 * @since 5.9.0 1223 * 1143 1224 * @deprecated 6.3.0 Use WP_Navigation_Fallback::parse_blocks_from_menu_items() instead. 1144 1225 * … … 1198 1279 * Get the classic navigation menu to use as a fallback. 1199 1280 * 1281 * @since 6.2.0 1282 * 1200 1283 * @deprecated 6.3.0 Use WP_Navigation_Fallback::get_classic_menu_fallback() instead. 1201 1284 * … … 1242 1325 * Converts a classic navigation to blocks. 1243 1326 * 1327 * @since 6.2.0 1328 * 1244 1329 * @deprecated 6.3.0 Use WP_Navigation_Fallback::get_classic_menu_fallback_blocks() instead. 1245 1330 * … … 1283 1368 /** 1284 1369 * If there's a classic menu then use it as a fallback. 1370 * 1371 * @since 6.2.0 1285 1372 * 1286 1373 * @deprecated 6.3.0 Use WP_Navigation_Fallback::create_classic_menu_fallback() instead. … … 1329 1416 * Finds the most recently published `wp_navigation` Post. 1330 1417 * 1418 * @since 6.1.0 1419 * 1331 1420 * @deprecated 6.3.0 Use WP_Navigation_Fallback::get_most_recently_published_navigation() instead. 1332 1421 * … … 1360 1449 * Accepts the serialized markup of a block and its inner blocks, and returns serialized markup of the inner blocks. 1361 1450 * 1451 * @since 6.5.0 1452 * 1362 1453 * @param string $serialized_block The serialized markup of a block and its inner blocks. 1363 1454 * @return string … … 1372 1463 * Mock a parsed block for the Navigation block given its inner blocks and the `wp_navigation` post object. 1373 1464 * The `wp_navigation` post's `_wp_ignored_hooked_blocks` meta is queried to add the `metadata.ignoredHookedBlocks` attribute. 1465 * 1466 * @since 6.5.0 1374 1467 * 1375 1468 * @param array $inner_blocks Parsed inner blocks of a Navigation block. … … 1412 1505 * of those hooked blocks should be exempted from insertion. 1413 1506 * 1507 * @since 6.5.0 1508 * 1414 1509 * @param array $inner_blocks Parsed inner blocks of a Navigation block. 1415 1510 * @param WP_Post $post `wp_navigation` post object corresponding to the block. … … 1437 1532 * mock Navigation block wrapper. 1438 1533 * 1534 * @since 6.5.0 1535 * 1439 1536 * @param array $inner_blocks Parsed inner blocks of a Navigation block. 1440 1537 * @param WP_Post $post `wp_navigation` post object corresponding to the block. … … 1540 1637 * Hooks into the REST API response for the core/navigation block and adds the first and last inner blocks. 1541 1638 * 1639 * @since 6.5.0 1640 * 1542 1641 * @param WP_REST_Response $response The response object. 1543 1642 * @param WP_Post $post Post object. … … 1554 1653 $content = block_core_navigation_remove_serialized_parent_block( $content ); 1555 1654 1556 $response->data['content']['raw'] = $content; 1655 $response->data['content']['raw'] = $content; 1656 1657 /** This filter is documented in wp-includes/post-template.php */ 1557 1658 $response->data['content']['rendered'] = apply_filters( 'the_content', $content ); 1558 1659
Note: See TracChangeset
for help on using the changeset viewer.