#62114 closed defect (bug) (fixed)
Editor: Default attribute value not used with `get_block_wrapper_attributes`
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 6.7 | Priority: | normal |
Severity: | normal | Version: | 5.6 |
Component: | Editor | Keywords: | has-patch has-unit-tests |
Focuses: | Cc: |
Description
Filed on GitHub in Gutenberg repository as two different issues.
Default attributes for block-support properties don't apply on dynamic blocks:
I'm building a dynamic block, which supports a handful of the built-in style settings (colors, spacing, etc). I can set defaults in block.json that apply in the editor, but when I view the front end, it's like nothing is set. get_block_wrapper_attributes only returns the block class name, none of the color classes are set, and no style attribute.
It appears that the default attributes don't exist in parsed_block, which is what apply_block_supports uses to render the values in PHP.
Default block alignment class is not in get_block_wrapper_attributes:
The block should have a full width alignment by default (mentioned here in the documentation: https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#align)
This works good in the editor. But in my render file, the get_block_wrapper_attributes() function is not outputting the align class.
The align class is only returned when I configure another block width then the one that’s in the attributes (so ‘none’ or ‘wide’). The default alignment is never returned, even after toggling another one and going back to the default alignment.
Change History (5)
This ticket was mentioned in PR #7438 on WordPress/wordpress-develop by @gziolo.
7 months ago
#1
- Keywords has-patch has-unit-tests added
#4
@
7 months ago
- Owner set to gziolo
- Resolution set to fixed
- Status changed from new to closed
In 59093:
7 months ago
#5
Committed with https://core.trac.wordpress.org/changeset/59093.
Trac ticket: https://core.trac.wordpress.org/ticket/62114