You are here

entityreference_dragdrop.install in Entity Reference Drag & Drop 7

Install file for the entityreference_dragdrop module.

File

entityreference_dragdrop.install
View source
<?php

/**
 * @file
 * Install file for the entityreference_dragdrop module.
 */

/**
 * Update drag&drop widget settings for existing fields.
 */
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);
          }
        }
      }
    }
  }
}

Functions

Namesort descending Description
entityreference_dragdrop_update_7101 Update drag&drop widget settings for existing fields.