-
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 #6555
base: trunk
Are you sure you want to change the base?
Conversation
As @tjcafferkey mentioned in a DM, variations are still missing a class name on the frontend. E.g. replacing The reason is that the block is missing the |
Per WordPress/gutenberg#43743 (comment):
In the vein of that comment, I tried to apply the following patch to this PR: diff --git a/src/wp-includes/class-wp-block.php b/src/wp-includes/class-wp-block.php
index 960bee9260..9f3a3a14ce 100644
--- a/src/wp-includes/class-wp-block.php
+++ b/src/wp-includes/class-wp-block.php
@@ -128,7 +128,7 @@ class WP_Block {
*/
public function __construct( $block, $available_context = array(), $registry = null ) {
$this->parsed_block = $block;
- $this->name = $block['blockName'];
+ $this->name = $this->get_canonical_block_name( $block['blockName'] );
if ( is_null( $registry ) ) {
$registry = WP_Block_Type_Registry::get_instance();
@@ -136,8 +136,7 @@ class WP_Block {
$this->registry = $registry;
- $block_name = $this->get_canonical_block_name( $this->name );
- $this->block_type = $registry->get_registered( $block_name );
+ $this->block_type = $registry->get_registered( $this->name );
$this->available_context = $available_context;
Since this would set This is quite puzzling to me. One potential explanation I could see was that the class name was generated based on the parsed block's We'll need to investigate this a bit more. |
This is happening because when we apply block support functionality we pass in the Fetching the We may need to either a) register variations as a At the moment I'm leaning towards option B because I don't think we should register variations as |
…ff off on off off off on on off off off off on off off off off off off off on off off off off on off off on off off off on on off on on off off off on off off on off off on off off on off on off off on off on off off off off on off off off on off off on off off off off off off off off on off on off off on off off off on off off off on off off off off on off on off on off on off off on off on off off on on on off on on off on on on on off off off off on on off off on off off off off off on off off on off off on on off off off off off on off off off off on on off on off off on off off on off on off off off off off off off off off off on on off on off off off arg to appy_block_supports function
In this PR currently when we retrieve the Whereas in the What this means is that we will have a This is a mismatch I believe we should fix. |
Following on from my previous comment, it feels as though we need to always return the instance of the canonical block. Here are two other approaches for this same problem. |
Trac ticket:
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.