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.

CommentFileSizeAuthor
#2 undefined_index_module-1728488-3.patch866 bytesimclean

Comments

imclean’s picture

Status: Patch (to be ported) » Active

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

imclean’s picture

Version: 7.x-1.0 » 7.x-1.x-dev
Assigned: vasiliy0s » Unassigned
Status: Active » Needs review
StatusFileSize
new866 bytes

Ok that was fairly straight forward. Thanks @vasiliy0s.

imclean’s picture

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

jpstrikesback’s picture

Status: Needs review » Reviewed & tested by the community

#2 removes the notice vasiliy0s, imclean, thanks.

jpstrikesback’s picture

Status: Reviewed & tested by the community » Needs review
trumanru’s picture

Thanks for patch #2. It works for me too.

jpstrikesback’s picture

Status: Needs review » Reviewed & tested by the community

Gonna RTBC this, change back if necessary

amateescu’s picture

Status: Reviewed & tested by the community » Closed (won't fix)

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

thedosmann’s picture

As 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:

12: _field_info_prepare_instance_widget (Array, 4 elements)
file (String, 55 characters ) /home/site/public_html/modules/field/field....
line (Integer) 302
function (String, 35 characters ) _field_info_prepare_instance_widget | (Callback) _field_info_prepare_instance_widget();
args (Array, 2 elements)
0 (Array, 17 elements)
no_ui (Boolean) TRUE
settings (Array, 2 elements)
entity_types (Array, 0 elements)
translatable (String, 1 characters ) 0
storage (Array, 5 elements)
foreign keys (Array, 0 elements)
indexes (Array, 1 element)
id (String, 2 characters ) 29
field_name (String, 11 characters ) group_group
type (String, 12 characters ) list_boolean
module (String, 4 characters ) list
active (String, 1 characters ) 1
locked (String, 1 characters ) 0
cardinality (String, 1 characters ) 1
deleted (String, 1 characters ) 0
columns (Array, 1 element)
bundles (Array, 0 elements)
1 (Array, 5 elements)
weight (String, 1 characters ) 0
type (String, 28 characters ) field_extrawidgets_read_only
module (NULL)
active (Integer) 1
settings (Array, 4 elements)
display_label (Integer) 0
formatter (String, 0 characters )
formatter_settings (Array, 0 elements)
display_empty (Integer) 0

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

amateescu’s picture

Version: 7.x-1.x-dev » 7.x-1.0
Status: Closed (won't fix) » Active

Or you can just use the -dev version :)

thedosmann’s picture

Thanks, 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.

joachim’s picture

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

amateescu’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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

vasiliy0s’s picture

Issue summary: View changes

Hide private info