[wp-trac] [WordPress Trac] #59574: Blocks: No toggle shown for hooked blocks added via filter
WordPress Trac
noreply at wordpress.org
Mon Feb 5 09:34:07 UTC 2024
#59574: Blocks: No toggle shown for hooked blocks added via filter
-----------------------------+------------------------------
Reporter: Bernhard Reiter | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version:
Severity: normal | Resolution:
Keywords: | Focuses:
-----------------------------+------------------------------
Comment (by Bernhard Reiter):
Replying to [comment:10 gziolo]:
> > We can infer them from the blockHooks field of the `block-types'
endpoint, but that is non-contextual; so we won't be able to correctly set
the attribute if any hooked blocks were added (or removed) by a filter.
>
> How much is that an issue? What are the use cases where that would fail?
What are the consequences?
It's less about the toggle not being shown but rather about the
[https://github.com/WordPress/wordpress-
develop/pull/5712#issuecomment-1838758546 other problem] with inserting a
new anchor block into an already-modified template. To set the
`ignoredHookedBlocks` attribute upon insertion, we also need to know which
hooked blocks would be inserted; and if those are set contextually by the
`hooked_block_types` filter (e.g. only when inside the "Single" template
or "Header" area template part), the editor won't have any knowledge of
them.
> The technical solution explored is very complex and depends on several
moving parts. We need to keep in mind that the editor is only an
approximation of what we will see on the frontend. In particular, when
using WP hook, there might be nuances that change depending on the
currently browsed page.
IMO, if we'd like insertion of a new anchor block to work before enabling
[https://github.com/WordPress/wordpress-develop/pull/5726 insertion into
modified templates], then we should also address this issue. The good news
is that I have a [https://github.com/WordPress/gutenberg/pull/58622
prototype] that I think will solve this problem.
My plan is to get the [https://github.com/WordPress/gutenberg/pull/58553
PR that sets the `ignoredHookedBlocks` attribute on newly inserted anchor
blocks] (based on the non-contextual information from the `block-types`
endpoint) ready today, and then work on the new
[https://github.com/WordPress/gutenberg/pull/58622 `hooked-blocks`
endpoint controller] tomorrow, as it can be seen as a refinement. (I'll
post an update to the [https://github.com/WordPress/gutenberg/issues/54904
Epic] shortly.)
--
Ticket URL: <https://core.trac.wordpress.org/ticket/59574#comment:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list