[wp-trac] [WordPress Trac] #62114: Editor: Default attribute value not used with `get_block_wrapper_attributes`
WordPress Trac
noreply at wordpress.org
Wed Sep 25 13:31:27 UTC 2024
#62114: Editor: Default attribute value not used with
`get_block_wrapper_attributes`
--------------------------+--------------------
Reporter: gziolo | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 6.7
Component: Editor | Version: 5.6
Severity: normal | Keywords:
Focuses: |
--------------------------+--------------------
Filed on GitHub in Gutenberg repository as two different issues.
[https://github.com/WordPress/gutenberg/issues/50229 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.
[https://github.com/WordPress/gutenberg/issues/50027 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.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/62114>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list