Conversation
Size Change: 0 B Total Size: 1.23 MB ℹ️ View Unchanged
|
@@ -101,11 +101,15 @@ public function add_data_attributes( $content, $block ) { | |||
} | |||
|
|||
$attributes = (array) $block['attrs']; | |||
$exclude_attributes = [ 'className', 'align' ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works as expected, although a bit limiting as a start. $exclude_attributes can't be extended.
Is it possible for blocks to implement this themselves? as in:
- Ignore the block using a filter.
- Reimplement this function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tbh I think under our namespace we want all attributes present. These core attributes are outliers.
Other blocks are not forced to use this handling. render_block
filter is available to all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works as expected.
* Remove inject_html_data_attributes * Exclude class/align attributes from injection
We seem to have duplicate data attributes in the saved HTML markup. This is due to
inject_html_data_attributes()
code, as well as the new render filter which applies to all blocks in our namespace:Since
add_data_attributes
applies to allwoocommerce
blocks, we can removeinject_html_data_attributes
.Fixes #4867
Testing
Changelog