@wordpress/block-library 8.28.6 → 8.28.7

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-library",
3
- "version": "8.28.6",
3
+ "version": "8.28.7",
4
4
  "description": "Block library for the WordPress editor.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -80,5 +80,5 @@
80
80
  "publishConfig": {
81
81
  "access": "public"
82
82
  },
83
- "gitHead": "7d2a00f1998a0a696694802725e523628f994cfc"
83
+ "gitHead": "f9c196db2b8acef093488f0c5ef93cc50485cd6f"
84
84
  }
@@ -543,8 +543,7 @@ class WP_Navigation_Block_Renderer {
543
543
  /**
544
544
  * Gets the nav element directives.
545
545
  *
546
- * @param bool $is_interactive Whether the block is interactive.
547
- * @param array $attributes The block attributes.
546
+ * @param bool $is_interactive Whether the block is interactive.
548
547
  * @return string the directives for the navigation element.
549
548
  */
550
549
  private static function get_nav_element_directives( $is_interactive ) {
@@ -1458,17 +1457,25 @@ function block_core_navigation_set_ignored_hooked_blocks_metadata( $inner_blocks
1458
1457
  /**
1459
1458
  * Updates the post meta with the list of ignored hooked blocks when the navigation is created or updated via the REST API.
1460
1459
  *
1460
+ * @access private
1461
+ * @since 6.5.0
1462
+ *
1461
1463
  * @param stdClass $post Post object.
1464
+ * @return stdClass The updated post object.
1462
1465
  */
1463
1466
  function block_core_navigation_update_ignore_hooked_blocks_meta( $post ) {
1464
- // We run the Block Hooks mechanism to inject the `metadata.ignoredHookedBlocks` attribute into
1465
- // all anchor blocks. For the root level, we create a mock Navigation and extract them from there.
1467
+ /*
1468
+ * We run the Block Hooks mechanism to inject the `metadata.ignoredHookedBlocks` attribute into
1469
+ * all anchor blocks. For the root level, we create a mock Navigation and extract them from there.
1470
+ */
1466
1471
  $blocks = parse_blocks( $post->post_content );
1467
1472
 
1468
- // Block Hooks logic requires a `WP_Post` object (rather than the `stdClass` with the updates that
1469
- // we're getting from the `rest_pre_insert_wp_navigation` filter) as its second argument (to be
1470
- // used as context for hooked blocks insertion).
1471
- // We thus have to look it up from the DB,based on `$post->ID`.
1473
+ /*
1474
+ * Block Hooks logic requires a `WP_Post` object (rather than the `stdClass` with the updates that
1475
+ * we're getting from the `rest_pre_insert_wp_navigation` filter) as its second argument (to be
1476
+ * used as context for hooked blocks insertion).
1477
+ * We thus have to look it up from the DB,based on `$post->ID`.
1478
+ */
1472
1479
  $markup = block_core_navigation_set_ignored_hooked_blocks_metadata( $blocks, get_post( $post->ID ) );
1473
1480
 
1474
1481
  $root_nav_block = parse_blocks( $markup )[0];
@@ -1489,22 +1496,28 @@ function block_core_navigation_update_ignore_hooked_blocks_meta( $post ) {
1489
1496
  return $post;
1490
1497
  }
1491
1498
 
1492
- // Before adding our filter, we verify if it's already added in Core.
1493
- // However, during the build process, Gutenberg automatically prefixes our functions with "gutenberg_".
1494
- // Therefore, we concatenate the Core's function name to circumvent this prefix for our check.
1495
- $rest_insert_wp_navigation_core_callback = 'block_core_navigation_' . 'update_ignore_hooked_blocks_meta';
1499
+ /*
1500
+ * Before adding our filter, we verify if it's already added in Core.
1501
+ * However, during the build process, Gutenberg automatically prefixes our functions with "gutenberg_".
1502
+ * Therefore, we concatenate the Core's function name to circumvent this prefix for our check.
1503
+ */
1504
+ $rest_insert_wp_navigation_core_callback = 'block_core_navigation_' . 'update_ignore_hooked_blocks_meta'; // phpcs:ignore Generic.Strings.UnnecessaryStringConcat.Found
1496
1505
 
1497
- // Injection of hooked blocks into the Navigation block relies on some functions present in WP >= 6.5
1498
- // that are not present in Gutenberg's WP 6.5 compatibility layer.
1506
+ /*
1507
+ * Injection of hooked blocks into the Navigation block relies on some functions present in WP >= 6.5
1508
+ * that are not present in Gutenberg's WP 6.5 compatibility layer.
1509
+ */
1499
1510
  if ( function_exists( 'set_ignored_hooked_blocks_metadata' ) && ! has_filter( 'rest_pre_insert_wp_navigation', $rest_insert_wp_navigation_core_callback ) ) {
1500
- add_filter( 'rest_pre_insert_wp_navigation', 'block_core_navigation_update_ignore_hooked_blocks_meta', 10 );
1511
+ add_filter( 'rest_pre_insert_wp_navigation', 'block_core_navigation_update_ignore_hooked_blocks_meta' );
1501
1512
  }
1502
1513
 
1503
- // Previous versions of Gutenberg and WordPress 6.5 Betas were attaching the block_core_navigation_update_ignore_hooked_blocks_meta
1504
- // function to the `rest_insert_wp_navigation` _action_ (rather than the `rest_pre_insert_wp_navigation` _filter_).
1505
- // To avoid collisions, we need to remove the filter from that action if it's present.
1514
+ /*
1515
+ * Previous versions of Gutenberg were attaching the block_core_navigation_update_ignore_hooked_blocks_meta
1516
+ * function to the `rest_insert_wp_navigation` _action_ (rather than the `rest_pre_insert_wp_navigation` _filter_).
1517
+ * To avoid collisions, we need to remove the filter from that action if it's present.
1518
+ */
1506
1519
  if ( has_filter( 'rest_insert_wp_navigation', $rest_insert_wp_navigation_core_callback ) ) {
1507
- remove_filter( 'rest_insert_wp_navigation', $rest_insert_wp_navigation_core_callback, 10 );
1520
+ remove_filter( 'rest_insert_wp_navigation', $rest_insert_wp_navigation_core_callback );
1508
1521
  }
1509
1522
 
1510
1523
  /**
@@ -1512,7 +1525,6 @@ if ( has_filter( 'rest_insert_wp_navigation', $rest_insert_wp_navigation_core_ca
1512
1525
  *
1513
1526
  * @param WP_REST_Response $response The response object.
1514
1527
  * @param WP_Post $post Post object.
1515
- * @param WP_REST_Request $request Request object.
1516
1528
  * @return WP_REST_Response The response object.
1517
1529
  */
1518
1530
  function block_core_navigation_insert_hooked_blocks_into_rest_response( $response, $post ) {
@@ -1531,13 +1543,17 @@ function block_core_navigation_insert_hooked_blocks_into_rest_response( $respons
1531
1543
  return $response;
1532
1544
  }
1533
1545
 
1534
- // Before adding our filter, we verify if it's already added in Core.
1535
- // However, during the build process, Gutenberg automatically prefixes our functions with "gutenberg_".
1536
- // Therefore, we concatenate the Core's function name to circumvent this prefix for our check.
1546
+ /*
1547
+ * Before adding our filter, we verify if it's already added in Core.
1548
+ * However, during the build process, Gutenberg automatically prefixes our functions with "gutenberg_".
1549
+ * Therefore, we concatenate the Core's function name to circumvent this prefix for our check.
1550
+ */
1537
1551
  $rest_prepare_wp_navigation_core_callback = 'block_core_navigation_' . 'insert_hooked_blocks_into_rest_response';
1538
1552
 
1539
- // Injection of hooked blocks into the Navigation block relies on some functions present in WP >= 6.5
1540
- // that are not present in Gutenberg's WP 6.5 compatibility layer.
1553
+ /*
1554
+ * Injection of hooked blocks into the Navigation block relies on some functions present in WP >= 6.5
1555
+ * that are not present in Gutenberg's WP 6.5 compatibility layer.
1556
+ */
1541
1557
  if ( function_exists( 'set_ignored_hooked_blocks_metadata' ) && ! has_filter( 'rest_prepare_wp_navigation', $rest_prepare_wp_navigation_core_callback ) ) {
1542
1558
  add_filter( 'rest_prepare_wp_navigation', 'block_core_navigation_insert_hooked_blocks_into_rest_response', 10, 3 );
1543
1559
  }