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 prints, listed features, re-exported some features, and force-reverted some features.

Files: 
CommentFileSizeAuthor
#6 features-update_hook_field_default_doc-2085159-6.patch1.01 KBmariacha1
PASSED: [[SimpleTest]]: [MySQL] 40 pass(es).
[ View ]

Comments

hefox’s picture

Status:Active» Postponed

I'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?

nadavoid’s picture

I 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().)

nadavoid’s picture

Title:hook_field_default_fields_alter() not being called» hook_field_default_fields_alter() has been replaced by two new hooks
Component:Field» Documentation
Status:Postponed» Active

It 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.

hefox’s picture

Title:hook_field_default_fields_alter() has been replaced by two new hooks» Document hook_field_default_field_instances_alter/hook_field_default_field_bases_alter(

hook_field_default_fields_alter does still exist since field component exists, but deprecated

hefox’s picture

Category:bug» task
mariacha1’s picture

Issue summary:View changes
Status:Active» Needs review
StatusFileSize
new1.01 KB
PASSED: [[SimpleTest]]: [MySQL] 40 pass(es).
[ View ]

Here's my simple update to the documentation in features.api.php. Is there anywhere else the documentation should be updated?

Status:Needs review» Needs work

The last submitted patch, 6: features-update_hook_field_default_doc-2085159-6.patch, failed testing.

mariacha1’s picture

Status:Needs work» Needs review

Status:Needs review» Needs work

The last submitted patch, 6: features-update_hook_field_default_doc-2085159-6.patch, failed testing.

djdevin’s picture

Version:7.x-2.0-rc3» 7.x-2.x-dev
Status:Needs work» Reviewed & tested by the community

Can we get this committed? Docs look good.

Lost sanity over this one.

hefox’s picture

hefox’s picture

Status:Reviewed & tested by the community» Fixed

thanks

  • Commit 247212e on 7.x-2.x, 7.x-2.x-2047253 authored by mariacha1, committed by hefox:
    Issue #2085159 by mariacha1: add documentation for...

Status:Fixed» Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.