Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I've implemented hook_field_default_fields_alter()
, but it never gets called. I'm using 7.x-2.0-rc3.
I think I've tried about everything: I cleared cache from the browser and from drush, set a breakpoint inside my hook implementation, added dpm()
s and print
s, listed features, re-exported some features, and force-reverted some features.
Comment | File | Size | Author |
---|---|---|---|
#6 | features-update_hook_field_default_doc-2085159-6.patch | 1.01 KB | mariacha1 |
Comments
Comment #1
hefox CreditAttribution: hefox commentedI've been using it fine and knowing the code, I don't see know where there would be a bug so my guess it's something with your setup
However, note that 'field' is depacated in 2.x and has been replaced with field_instance and field_base components, are you sure you're using the right hook?
Comment #2
nadavoid CreditAttribution: nadavoid commentedI bet you're right, that I'm using the wrong hook. But I'm sure I'm using what's currently documented in features.api.php. Maybe this needs to be a documentation update? I'll try some other hooks... Should I replace "field" or "fields" with "field_instance"? (e.g. hook_field_instance_default_fields_alter() or hook_field_default_field_instances_alter().)
Comment #3
nadavoid CreditAttribution: nadavoid commentedIt looks like it should be hook_field_default_field_instances_alter() and hook_field_default_field_bases_alter(). So features.api.php should be updated since it still only has a reference to the older, combined hook: hook_field_default_fields_alter. That should be replaced by the two new hooks. Besides that, should the documentation remain the same? (e.g.
&$fields
getting passed by reference?)Setting it back to "active" since it's pretty clear this is just a documentation update now.
Comment #4
hefox CreditAttribution: hefox commentedhook_field_default_fields_alter does still exist since field component exists, but deprecated
Comment #5
hefox CreditAttribution: hefox commentedComment #6
mariacha1 CreditAttribution: mariacha1 commentedHere's my simple update to the documentation in features.api.php. Is there anywhere else the documentation should be updated?
Comment #8
mariacha1 CreditAttribution: mariacha1 commented6: features-update_hook_field_default_doc-2085159-6.patch queued for re-testing.
Comment #10
djdevinCan we get this committed? Docs look good.
Lost sanity over this one.
Comment #11
hefox CreditAttribution: hefox commented6: features-update_hook_field_default_doc-2085159-6.patch queued for re-testing.
Comment #12
hefox CreditAttribution: hefox commentedthanks