Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion lib/compat/wordpress-6.5/navigation-block-variations.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function gutenberg_navigation_link_variations_compat( $args ) {
if ( 'core/navigation-link' !== $args['name'] || ! empty( $args['variation_callback'] ) ) {
return $args;
}
$args['variation_callback'] = 'build_navigation_link_block_variations';
$args['variation_callback'] = 'gutenberg_block_core_navigation_link_build_variations';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should there really be the gutenberg_ prefix here? I only see a function called block_core_navigation_link_build_variations, without the prefix. Here:

https://github.com/WordPress/gutenberg/blob/trunk/packages/block-library/src/navigation-link/index.php#L354

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's my understading that the code in the lib/compat folder only gets loaded if the gutenberg plugin is active on a wordpress installtion with version 6.4/6.3. But the code is not merged into core. And the gutenber plugin prefixes all functions in the block-library with 'gutenberg_' on build process, to avoid a clash with existinf core functions.
In my local testing with wp 6.4 this works and the function is called -> the variations for core post types and post types registeres before init#10 are created.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, I didn't know this 🙂

return $args;
}

Expand Down
1 change: 0 additions & 1 deletion packages/block-library/src/navigation-link/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,6 @@ function block_core_navigation_link_build_variations() {
* Registers the navigation link block.
*
* @uses render_block_core_navigation_link()
* @uses build_navigation_link_block_variations()
* @throws WP_Error An WP_Error exception parsing the block definition.
*/
function register_block_core_navigation_link() {
Expand Down