Closed codepuncher closed 1 year ago
Sorry for the late response.
Thanks for finding out you can do this. We'll need to update the stubs, etc. and then yeah push a major release since it's a breaking change.
Do you want me to take over or do you want to do the remaining changes?
Unfortunately I don't have the availability to continue with it - feel free to take over.
Superseded by #154
Ref #144 and #143
I have played about locally on this and seems we can simply pass the
$block
array to theenqueue
method which gives access to$block['data']['my_field_name']
. This allowed me to conditionally enqueue assets depending on field values.This PR needs more work like adding the argument to
Block::enqueue($data = [])
but I opened the PR just to get the ball rolling on this. It would result in a breaking change since the signature has changed.@Log1x - anything to add to this? Not as nice as
get_field
in the method but hey it works.