Opened 4 years ago
Closed 4 years ago
#53140 closed enhancement (fixed)
State clearly that has_block() doesn't work in reusable blocks
Reported by: | vyskoczilova | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 5.8 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Editor | Keywords: | has-patch commit |
Focuses: | docs | Cc: |
Description
The has_block() function doesn't work in reusable blocks. Since the content of reusable blocks is not parsed yet (see my [blog post](https://kybernaut.cz/en/clanky/check-for-has_block-inside-reusable-blocks/) for more details).
That's fine, but I think that should be stated more clearly than the original [description](https://developer.wordpress.org/reference/functions/has_block/#description):
This test optimizes for performance rather than strict accuracy, detecting the block type exists but not validating its structure. For strict accuracy, you should use the block parser on post content.
I would suggest changing that to the following, so it's clear what it's mostly impacted with the "performance accuracy."
This test optimizes for performance rather than strict accuracy, detecting the block type exists but not validating its structure (e.g., doesn't check reusable blocks). For strict accuracy, you should use the block parser on post content.
What do you think?
I'm happy to submit it as a patch since it looks like a good "first issue," but never done it before.
Attachments (1)
Change History (8)
This ticket was mentioned in Slack in #core by chaion07. View the logs.
4 years ago
#3
@
4 years ago
- Keywords commit added
- Milestone changed from Awaiting Review to 5.8
Thanks for the ticket @vyskoczilova,
This was discussed in a triage session today and it was agreed that a little clarity around reusable blocks would be helpful.
I've moved this on to the 5.8 milestone and labeled it ready for commit.
Related #52628.
#4
follow-up:
↓ 5
@
4 years ago
Hi @peterwilsoncc! Thanks for the approval. Anything else should be done from my side? It's my first time with Trac.
I've quickly checked the triage session and as far as I know, there are no other blocks you need to render first, but I guess this can change.
#5
in reply to:
↑ 4
@
4 years ago
Replying to vyskoczilova:
Hi @peterwilsoncc! Thanks for the approval. Anything else should be done from my side?
No, nothing more needs to be done from your side. If another contributor has language change suggestions, then they can produce another patch and you'll still get props and become an official contributor yourself.
It's my first time with Trac.
If you prefer Git, then you are welcome to create a pull request on the GitHub mirror and link to a ticket in the description. Many committers use GitHub until it comes time to commit.
I've quickly checked the triage session and as far as I know, there are no other blocks you need to render first, but I guess this can change.
Great, thanks for checking.
The proposed change is attached as a patch.