@wordpress/block-library 8.12.2 → 8.12.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/latest-posts/index.php +1 -1
- package/src/navigation/index.php +24 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-library",
|
|
3
|
-
"version": "8.12.
|
|
3
|
+
"version": "8.12.3",
|
|
4
4
|
"description": "Block library for the WordPress editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
"publishConfig": {
|
|
84
84
|
"access": "public"
|
|
85
85
|
},
|
|
86
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "e3004c20a04ab04a1311a84bbd0dff857d093001"
|
|
87
87
|
}
|
|
@@ -51,7 +51,7 @@ function render_block_core_latest_posts( $attributes ) {
|
|
|
51
51
|
$filter_latest_posts_excerpt_more = static function( $more ) use ( $attributes ) {
|
|
52
52
|
$use_excerpt = 'excerpt' === $attributes['displayPostContentRadio'];
|
|
53
53
|
/* translators: %1$s is a URL to a post, excerpt truncation character, default … */
|
|
54
|
-
return $use_excerpt ? sprintf( __( ' … <a href="%1$s" rel="noopener noreferrer">Read more</a>'
|
|
54
|
+
return $use_excerpt ? sprintf( __( ' … <a href="%1$s" rel="noopener noreferrer">Read more</a>' ), esc_url( get_permalink() ) ) : $more;
|
|
55
55
|
};
|
|
56
56
|
|
|
57
57
|
add_filter( 'excerpt_more', $filter_latest_posts_excerpt_more );
|
package/src/navigation/index.php
CHANGED
|
@@ -94,7 +94,7 @@ if ( defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN ) {
|
|
|
94
94
|
*
|
|
95
95
|
* @return string Submenu markup with the directives injected.
|
|
96
96
|
*/
|
|
97
|
-
function
|
|
97
|
+
function block_core_navigation_add_directives_to_submenu( $w, $block_attributes ) {
|
|
98
98
|
while ( $w->next_tag(
|
|
99
99
|
array(
|
|
100
100
|
'tag_name' => 'LI',
|
|
@@ -124,7 +124,7 @@ if ( defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN ) {
|
|
|
124
124
|
};
|
|
125
125
|
|
|
126
126
|
// Iterate through subitems if exist.
|
|
127
|
-
|
|
127
|
+
block_core_navigation_add_directives_to_submenu( $w, $block_attributes );
|
|
128
128
|
}
|
|
129
129
|
return $w->get_updated_html();
|
|
130
130
|
};
|
|
@@ -341,7 +341,11 @@ function block_core_navigation_get_fallback_blocks() {
|
|
|
341
341
|
// If `core/page-list` is not registered then return empty blocks.
|
|
342
342
|
$fallback_blocks = $registry->is_registered( 'core/page-list' ) ? $page_list_fallback : array();
|
|
343
343
|
|
|
344
|
-
|
|
344
|
+
if ( class_exists( 'WP_Navigation_Fallback' ) ) {
|
|
345
|
+
$navigation_post = WP_Navigation_Fallback::get_fallback();
|
|
346
|
+
} else {
|
|
347
|
+
$navigation_post = Gutenberg_Navigation_Fallback::get_fallback();
|
|
348
|
+
}
|
|
345
349
|
|
|
346
350
|
// Use the first non-empty Navigation as fallback if available.
|
|
347
351
|
if ( $navigation_post ) {
|
|
@@ -673,7 +677,7 @@ function render_block_core_navigation( $attributes, $content, $block ) {
|
|
|
673
677
|
// Add directives to the submenu if needed.
|
|
674
678
|
if ( defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN && $has_submenus && $should_load_view_script ) {
|
|
675
679
|
$w = new WP_HTML_Tag_Processor( $inner_blocks_html );
|
|
676
|
-
$inner_blocks_html =
|
|
680
|
+
$inner_blocks_html = block_core_navigation_add_directives_to_submenu( $w, $attributes );
|
|
677
681
|
}
|
|
678
682
|
|
|
679
683
|
$modal_unique_id = wp_unique_id( 'modal-' );
|
|
@@ -836,6 +840,8 @@ add_filter( 'render_block_data', 'block_core_navigation_typographic_presets_back
|
|
|
836
840
|
/**
|
|
837
841
|
* Turns menu item data into a nested array of parsed blocks
|
|
838
842
|
*
|
|
843
|
+
* @deprecated 6.3.0 Use WP_Navigation_Fallback::parse_blocks_from_menu_items() instead.
|
|
844
|
+
*
|
|
839
845
|
* @param array $menu_items An array of menu items that represent
|
|
840
846
|
* an individual level of a menu.
|
|
841
847
|
* @param array $menu_items_by_parent_id An array keyed by the id of the
|
|
@@ -846,7 +852,7 @@ add_filter( 'render_block_data', 'block_core_navigation_typographic_presets_back
|
|
|
846
852
|
*/
|
|
847
853
|
function block_core_navigation_parse_blocks_from_menu_items( $menu_items, $menu_items_by_parent_id ) {
|
|
848
854
|
|
|
849
|
-
_deprecated_function( __FUNCTION__, '6.3.0', '
|
|
855
|
+
_deprecated_function( __FUNCTION__, '6.3.0', 'WP_Navigation_Fallback::parse_blocks_from_menu_items' );
|
|
850
856
|
|
|
851
857
|
if ( empty( $menu_items ) ) {
|
|
852
858
|
return array();
|
|
@@ -891,11 +897,13 @@ function block_core_navigation_parse_blocks_from_menu_items( $menu_items, $menu_
|
|
|
891
897
|
/**
|
|
892
898
|
* Get the classic navigation menu to use as a fallback.
|
|
893
899
|
*
|
|
900
|
+
* @deprecated 6.3.0 Use WP_Navigation_Fallback::get_classic_menu_fallback() instead.
|
|
901
|
+
*
|
|
894
902
|
* @return object WP_Term The classic navigation.
|
|
895
903
|
*/
|
|
896
904
|
function block_core_navigation_get_classic_menu_fallback() {
|
|
897
905
|
|
|
898
|
-
_deprecated_function( __FUNCTION__, '6.3.0', '
|
|
906
|
+
_deprecated_function( __FUNCTION__, '6.3.0', 'WP_Navigation_Fallback::get_classic_menu_fallback' );
|
|
899
907
|
|
|
900
908
|
$classic_nav_menus = wp_get_nav_menus();
|
|
901
909
|
|
|
@@ -933,12 +941,14 @@ function block_core_navigation_get_classic_menu_fallback() {
|
|
|
933
941
|
/**
|
|
934
942
|
* Converts a classic navigation to blocks.
|
|
935
943
|
*
|
|
944
|
+
* @deprecated 6.3.0 Use WP_Navigation_Fallback::get_classic_menu_fallback_blocks() instead.
|
|
945
|
+
*
|
|
936
946
|
* @param object $classic_nav_menu WP_Term The classic navigation object to convert.
|
|
937
947
|
* @return array the normalized parsed blocks.
|
|
938
948
|
*/
|
|
939
949
|
function block_core_navigation_get_classic_menu_fallback_blocks( $classic_nav_menu ) {
|
|
940
950
|
|
|
941
|
-
_deprecated_function( __FUNCTION__, '6.3.0', '
|
|
951
|
+
_deprecated_function( __FUNCTION__, '6.3.0', 'WP_Navigation_Fallback::get_classic_menu_fallback_blocks' );
|
|
942
952
|
|
|
943
953
|
// BEGIN: Code that already exists in wp_nav_menu().
|
|
944
954
|
$menu_items = wp_get_nav_menu_items( $classic_nav_menu->term_id, array( 'update_post_term_cache' => false ) );
|
|
@@ -971,13 +981,15 @@ function block_core_navigation_get_classic_menu_fallback_blocks( $classic_nav_me
|
|
|
971
981
|
}
|
|
972
982
|
|
|
973
983
|
/**
|
|
974
|
-
* If there's a
|
|
984
|
+
* If there's a classic menu then use it as a fallback.
|
|
985
|
+
*
|
|
986
|
+
* @deprecated 6.3.0 Use WP_Navigation_Fallback::create_classic_menu_fallback() instead.
|
|
975
987
|
*
|
|
976
988
|
* @return array the normalized parsed blocks.
|
|
977
989
|
*/
|
|
978
990
|
function block_core_navigation_maybe_use_classic_menu_fallback() {
|
|
979
991
|
|
|
980
|
-
_deprecated_function( __FUNCTION__, '6.3.0', '
|
|
992
|
+
_deprecated_function( __FUNCTION__, '6.3.0', 'WP_Navigation_Fallback::create_classic_menu_fallback' );
|
|
981
993
|
|
|
982
994
|
// See if we have a classic menu.
|
|
983
995
|
$classic_nav_menu = block_core_navigation_get_classic_menu_fallback();
|
|
@@ -1016,11 +1028,13 @@ function block_core_navigation_maybe_use_classic_menu_fallback() {
|
|
|
1016
1028
|
/**
|
|
1017
1029
|
* Finds the most recently published `wp_navigation` Post.
|
|
1018
1030
|
*
|
|
1031
|
+
* @deprecated 6.3.0 Use WP_Navigation_Fallback::get_most_recently_published_navigation() instead.
|
|
1032
|
+
*
|
|
1019
1033
|
* @return WP_Post|null the first non-empty Navigation or null.
|
|
1020
1034
|
*/
|
|
1021
1035
|
function block_core_navigation_get_most_recently_published_navigation() {
|
|
1022
1036
|
|
|
1023
|
-
_deprecated_function( __FUNCTION__, '6.3.0', '
|
|
1037
|
+
_deprecated_function( __FUNCTION__, '6.3.0', 'WP_Navigation_Fallback::get_most_recently_published_navigation' );
|
|
1024
1038
|
|
|
1025
1039
|
// Default to the most recently created menu.
|
|
1026
1040
|
$parsed_args = array(
|