acf-codifier icon indicating copy to clipboard operation
acf-codifier copied to clipboard

Custom fields and group parameters

Open ogorzalka opened this issue 5 years ago • 2 comments

Hi !

Sometimes ACF plugins add their own configuration keys in fields or field groups. is there a way to extend the Field or Group class to add additional properties?

thank you and congratulations for your great class 🙂

ogorzalka avatar Mar 22 '20 09:03 ogorzalka

The classes are not defined as final, so you can add any properties you want to them just by assigning them: $field->my_custom_property = 'value';

All properties in field and group objects are passed on to the ACF when the fields are registered, so any custom properties will be present there as well.

Nomafin avatar Mar 22 '20 09:03 Nomafin

I wanted to attach a new method to extend the field (set field as bidirectional for example) to make that reusable.

ogorzalka avatar Apr 05 '20 09:04 ogorzalka