You are here

function newsletter_update_exposed_tids in Newsletter 7

Since there is no hook_field_schema_alter() we will have to update the exposed lists tid manually. See #691932.

2 calls to newsletter_update_exposed_tids()
newsletter_entity_insert in ./newsletter.module
Implements hook_entity_insert().
newsletter_entity_update in ./newsletter.module
Implements hook_entity_update().

File

./newsletter.module, line 951
Defines menu items for newsletter administration, permissions and basic drupal hooks.

Code

function newsletter_update_exposed_tids($entity, $type) {
  if ($type == 'newsletter_subscriber') {
    $lists = field_get_items($type, $entity, 'field_newsletter_list');
    foreach ($lists as $list) {
      if (isset($list['target_id_tids'])) {
        db_update('field_data_field_newsletter_list')
          ->fields(array(
          'target_id_tids' => $list['target_id_tids'],
        ))
          ->condition('entity_id', $entity->nsid)
          ->condition('field_newsletter_list_target_id', $list['target_id'])
          ->execute();
      }
    }
  }
}