You are here

function entityreference_dragdrop_update_7101 in Entity Reference Drag & Drop 7

Update drag&drop widget settings for existing fields.

File

./entityreference_dragdrop.install, line 11
Install file for the entityreference_dragdrop module.

Code

function entityreference_dragdrop_update_7101() {
  foreach (field_info_fields() as $field_name => $field) {
    if ($field['type'] == 'entityreference') {
      foreach ($field['bundles'] as $entity_type => $bundles) {
        foreach ($bundles as $bundle) {
          $instance = field_info_instance($entity_type, $field_name, $bundle);
          if ($instance['widget']['type'] == 'entityreference_dragdrop') {
            $instance['widget']['settings']['available_entities_label'] = t('Available entities');
            $instance['widget']['settings']['selected_entities_label'] = t('Selected entities');
            field_update_instance($instance);
          }
        }
      }
    }
  }
}