AdvancedCustomFields / AdvancedCustomFields/acf
[ACF Blocks] Feature Request - Hook for header
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 945
- Forks
- 197
- PR merge metrics
- No merged PRs in 30d
Description
What's missing: Hooks available for me to add a tag to the header whenever a particular block renders.
Why? : Googles new Page Speed tools measure LCP. (Largest Contentful Paint) LCP, if it's an image, can be drastically reduced by preloading the asset so it loads faster. Therefore I want to make it so that whenever someone uses a hero banner block, it will preload the background image that they set in an ACF image field.
I can't find a way to do this currently even after having a look at available hooks, and appreciate it's not high priority but it would be nice.
Alternatively I can see it would be possible using parse_blocks() possibly and checking the block type of the first few blocks, but seems a lot longer than having a hook available with block ID / fields accessible.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the available ACF Blocks hooks and the parse_blocks() approach mentioned in the issue. Determine how a block's ID and fields could be exposed when a block renders so a caller can add a preload link for its image. Done means the requested hook behavior and accessible data are defined and documented for this use case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100