AdvancedCustomFields / acf

Advanced Custom Fields
http://advancedcustomfields.com/
823 stars 168 forks source link

get_block_wrapper_attributes() doesn't function properly when default attributes are set in block.json #884

Closed dodo-sofranko closed 7 months ago

dodo-sofranko commented 7 months ago

regarding to this issue https://github.com/AdvancedCustomFields/acf/issues/883

we misunderstood,

I don't want to get the default value of attribute via get_block_wrapper_attributes(). But get_block_wrapper_attributes() dont work properly if default value of atribute is set in block.json

on frontend there is missing classes about gradient, and gradient is set in backend

just try to check:

To Reproduce Steps to reproduce the behavior:

  1. For example I have own block: FAQ, In block.json I will add to set some default background such code: (there is bug also with paddings ...) "attributes": { "gradient": { "type": "string", "default": "vivid-cyan-blue-to-vivid-purple" }},

  2. In my rendered php I have <section <?= !$is_preview ? get_block_wrapper_attributes() : ''; ?>>

  3. Then I will add my block in gutenberg editor. (default background was set) and I will save

  4. Check frontend, and class has-vivid-cyan-blue-to-vivid-purple-gradient-background is missing there

  5. I will change to another background or gradient, and on frontend is showing correct

  6. then I will change gradient back to vivid-cyan-blue-to-vivid-purple and class is missing

lgladdy commented 7 months ago

No need to open a new issue here - please post this comment on your previous issue, #883.