I'm getting the following error when trying to use the Geocoder field widget to encode from another field on a Message entity:

Warning: array_key_exists(): The first argument should be either a string or an integer in geocoder_field_field_widget_settings_form() (line 45 of sites/all/modules/geocoder/modules/geocoder_field/geocoder_field.module).

I traced it back to the following code:

  $title_field = $entities[$instance['entity_type']]['entity keys']['label'];
  $all_fields[$title_field] = array(
    'field_name' => $title_field,
    'type' => 'text',
  );
  $entity_fields['title']['label'] = t(drupal_ucfirst($title_field));

The Message entity doesn't define ['entity keys']['label'], it sets it to FALSE instead. I'm not sure if this is a fault with the Message module or not.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

thirdender created an issue. See original summary.

thirdender’s picture

thirdender’s picture

I actually found another module that does not define an 'label' entity key. The Message module defines ['entity keys']['label'] as FALSE, but the Field Collection module leaves the label completely undefined. I've tweaked the patch so that it fixes this issue for both the Message and Field Collection entity types, and hopefully any other entity type that doesn't define a label.

  • Pol committed 7c35265 on 7.x-2.x authored by thirdender
    Issue #2708177 by thirdender: array_key_exists when entity does not...
Pol’s picture

Thanks!

tusharbodke’s picture

Status: Active » Fixed

Hi Pol & thirdender,

Updating this case as it look like resolved and patch is already merge to module.
Reopen if required.

Thanks

tusharbodke’s picture

Status: Fixed » Closed (fixed)