Move layout custom properties to filter.#37438
Conversation
|
Size Change: +186 B (0%) Total Size: 1.13 MB
ℹ️ View Unchanged
|
youknowriad
left a comment
There was a problem hiding this comment.
Thanks for following-up with this, this is very good I think.
| } | ||
|
|
||
| return $style; | ||
| return apply_filters( 'layout_styles', $style, $selector, $layout ); |
There was a problem hiding this comment.
Do we need extra filters (aka new APIs to support)? Can't we rely on render_block for the backend and editor.BlockListBlock for the frontend?
There was a problem hiding this comment.
Also potentially we don't need any filter, we can just add the logic to the "render_callback" of the navigation block in the backend and to "edit" function of the navigation block in the frontend?
There was a problem hiding this comment.
render_block and editor.BlockListBlock won't work because we can't get the layout properties from them. Would it help to name the filter __unstable while we figure out what works best in terms of API? Or is that naming convention not applicable to filters?
Also potentially we don't need any filter, we can just add the logic to the "render_callback" of the navigation block in the backend and to "edit" function of the navigation block in the frontend?
We could do something along these lines, but if we want to keep all the logic in the Nav block it might be easier (and cleaner) to just output all the items-justified- etc. classnames and hook the CSS off those.
|
Nice one. From just a quick test, layout properties appear to work as they should, both inside and outside of the modal, and in both horizontal and vertical orientations, as shown in this GIF: In being a mostly under the hood change, I imagine #36778 would also work as-is? I'll defer to Riad on a green light, but hopefully the testing was useful. |
|
@jasmussen whatever happens here shouldn't make a difference to #36778. The idea is to output exactly the same styles, it's how we generate and attach them that is changing. |
|
I just tried something different in #37473. |
|
Closing this in favour of #37473. |

Description
Follow-up from this discussion. Moves the custom properties optionally added to layout with
setCascadingPropertiesto a custom filter in the Navigation block.How has this been tested?
Create a Navigation block; change justification/orientation and verify everything works as expected in both editor and front end.
Screenshots
Types of changes
Bug fix (non-breaking change which fixes an issue)
Checklist:
*.native.jsfiles for terms that need renaming or removal).