After updating the module extra_widgets, I saw a notice on the control fields page:
Notice: Undefined index: module in function_field_info_prepare_instance_widget() (line 392 in file ***/modules/field/field.info.inc).
After adding two lines of code in a module, they were gone:
function field_extrawidgets_field_widget_info_alter(&$widgets) {
$widgets['field_extrawidgets_hidden'] = array(
'label' => t('Hidden'),
'module' => 'field_extrawidgets',
'description' => t('A widget that is completely hidden.'),
'field types' => array_keys(field_info_field_types()),
'settings' => array(),
'behaviors' => array(
'multiple values' => FIELD_BEHAVIOR_CUSTOM,
),
);
$widgets['field_extrawidgets_read_only'] = array(
'label' => t('Read-only'),
'module' => 'field_extrawidgets',
'description' => t('A widget that is read-only.'),
'field types' => array_keys(field_info_field_types()),
'settings' => array(
'formatter' => '',
'formatter_settings' => array(),
'display_empty' => 0,
),
'behaviors' => array(
'multiple values' => FIELD_BEHAVIOR_CUSTOM,
),
);
return $widgets;
}
Please update the project code to other Drupalers.
Comments
Comment #1
imclean commentedI'm also seeing the error when clearing the cache but this isn't patch. Which 2 lines are you talking about?
See: http://drupal.org/project/field_extrawidgets/git-instructions
Comment #2
imclean commentedOk that was fairly straight forward. Thanks @vasiliy0s.
Comment #3
imclean commentedI suspect this has to do with #1586334: field_extrawidgets makes the default widget for fields "Hidden".
Using hook_field_widget_info_alter() to add a widget would need the module to be specified.
Comment #4
jpstrikesback commented#2 removes the notice vasiliy0s, imclean, thanks.
Comment #5
jpstrikesback commentedComment #6
trumanru commentedThanks for patch #2. It works for me too.
Comment #7
jpstrikesback commentedGonna RTBC this, change back if necessary
Comment #8
amateescu commentedThis has been fixed in #1586334: field_extrawidgets makes the default widget for fields "Hidden" by reverting the initial patch that changed the hook to _alter() and committing the proper one.
A new 7.x-1.1 version will be released after Drupal 7.16 is out.
Comment #9
thedosmann commentedAs this is more of an annoyance issue I am simply asking as to the progress of this issue. I understand that this is covered ground but before I landed at this issue page I've gone through countless (well a lot anyways) of other similar issue pages .
This problem is connected to issue #1001060: Undefined index _field_info_prepare_instance_widget. I've spent some time looking into this and have concluded that it is related to this module. If I disable module, and clear cache the error goes away.
Re-enable and message re-appears.
In development mode it shows:
This prompted me to look at this module and disable and clear cache when the error disappeared. It returns when I re-enable.
It seems that the fixes in #1001060: Undefined index _field_info_prepare_instance_widget simply circumvents issues with modules that fail to set or unset array vars. I have applied the patches in that issue but the error returns on updates. I have not applied the patch above hoping it would progress to 7.1.1 but we are 7.17 of drupal now.
Before this point I did numerous other troubleshooting. I believe the core field_info.inc is set in stone so it is up to module maintainers to correct any isset issues.
I appreciate your work on this module and if I can assist in correcting please me know. I have not looked at your code yet but I'm willing to assist if needed. If 7.1.1 is not close I will apply above patch? undefined_index_module-1728488-3.patch
Comment #10
amateescu commentedOr you can just use the -dev version :)
Comment #11
thedosmann commentedThanks, this issue is on a production site and I've have been trying to cut out all the dev, patched, and RC, modules. Of course in a perfect world that would possible. In this case I have no choice but to go the dev version as this module is already tied in to set processes, Hoping 7.1.1 has the fix. Going another direction would be a pain. I appreciate your time and reply.
Comment #12
joachim commented> this issue is on a production site and I've have been trying to cut out all the dev, patched, and RC, modules.
Ditto.
Could we possibly have a new release for this fix please?
Comment #13
amateescu commentedHere we go: http://drupal.org/node/1859276
Comment #14.0
vasiliy0s commentedHide private info