acf-builder
acf-builder copied to clipboard
Activate method?
Thanks for this awesome library!
I'm pretty sure I'll be using it on all my ACF projects moving forward.
Reading through the documentation, I wonder why you don't simply include an activate method for your FieldsBuilder that sets up the necessary hook?
Thanks @christianmagill!
I'm interested in seeing how people are using it, so if you or anyone has anything to share I'd love to see it.
Regarding an activate method, maybe you can give me an example of what you mean? Do you mean have a function that calls acf_add_local_field_group and passes itself it?
class FieldsBuilder
{
...
function activate()
{
add_action('acf/init', function() {
acf_add_local_field_group($this->build());
});
}
}
Yes, that's what I meant! Just a quicker/simpler way to activate.
I started playing with the library last night so will keep you updated as other ideas come to mind.
My only hesitation with that is that it adds specific WordPress and ACF function calls to the library. I don't think the library currently does that anywhere else.
It also assumes that hook you want is acf/init which is probably the case, but I want to be sure. Like #30 I'm gonna think about this a bit more. But thanks for the suggestion and don't hesitate to send more.