-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Try: Render variation alias blocks (set canonical name early) #6594
base: trunk
Are you sure you want to change the base?
Try: Render variation alias blocks (set canonical name early) #6594
Conversation
As @tjcafferkey pointed out to me in DM, the fact that we're getting the $wrapper_attributes = get_block_wrapper_attributes(
array(
'class' => 'wp-social-link wp-social-link-' . $service . block_core_social_link_get_color_classes( $block->context ),
'style' => block_core_social_link_get_color_styles( $block->context ),
)
); So we can't rely on that for other blocks. Instead, we will have to generate the class name for the block variation. |
I've just pushed d7735f8 which is one attempt at solving the problem. It infers the block variation name based on the strategy described in WordPress/gutenberg#43743 (comment). This seems to work alright, but only for blocks whose variations are registered on the server side. Examples are the Template Part or Navigation Link blocks. (The Social Link block sadly isn't.) |
This is a variation (no pun intended) of @tjcafferkey's #6555. It's the same commits, but cut off after 52d6b3d -- i.e. with no changes to the
WP_Block_Type
andWP_Block_Type_Registry
classes. Instead, the canonical block name is extracted early on during instantiation of theWP_Block
instance, and used to interact with those other classes.This seems to be working for me:
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.