7

If you look at the hook_field_info() from Physical Fields the returned array has two keys that aren't mentioned in the documentation: property_type and property_callbacks. Can anyone explain what these are for? (Bonus question, are there any other missing keys in the documentation?!)

8

They're not part of Drupal core, but are extra keys provided/used by the Entity Module. The comments in entity.api.php clear it up quite nicely:

For providing entity property info for fields each field type may specify a property type to map to in its field info using the key 'property_type'. With that info in place useful defaults are generated, which is already suiting for a lot of field types.

However it's possible to specify further callbacks, that may alter the generated property info. To do so use the key 'property_callbacks' and set it to an array of function names. Apart from that any property info provided for a field instance using the key 'property info' is added in too.

I'm afraid I don't know of any other undocumented keys, but a comment in the same file just above the previous ones notes:

This is a placeholder for describing further keys for hook_field_info(), which are introduced by the entity API.

I would just keep your eye on that file when future versions of the Entity module come out to see if any new ones have been added; property_type and property_callbacks are the only ones mentioned at the time of writing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.