I'm looking through a Drupal 7 module code in an attempt to understand what it does. It implements hook_field_default_fields(), but I can't find any documentation on this.

What does this hook do?

I did find that the Field Types API seems to expose similar hooks such as hook_field_extra_fields(), but they aren't exactly the same.

1 Answer 1


It's a hook used from the Features module. Truly, the feature.api.php file, which should contain a description of all the hooks used by a module, contains a description for hook_field_default_fields_alter().

Deprecated as of 7.x-2.0.

Alter the default fields right before they are cached into the database.

@param array[] &$fields
By reference. The fields that have been declared by another feature.


Usually an alter hook is paired with a "normal" hook, but that is not always the case.
If you see that the hook is always invoked with drupal_alter('field_default_fields', /* the other arguments */), the module uses only the alter hook. Checking if the module itself implements hook_field_default_fields() or hook_field_default_fields_alter() would also help to understand which hook is used from the module. Unfortunately, in this case, the module doesn't implement neither one or the other hook. This is easily explained from the fact the hook has been deprecated. (A module should be the first one not to implement its own deprecated hooks.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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