You are here

function mailchimp_lists_field_prepare_view in Mailchimp 7.4

Same name and namespace in other branches
  1. 7.5 modules/mailchimp_lists/includes/mailchimp_lists.field.inc \mailchimp_lists_field_prepare_view()
  2. 7.3 modules/mailchimp_lists/includes/mailchimp_lists.field.inc \mailchimp_lists_field_prepare_view()

Implements hook_field_prepare_view().

Our field has no actual data in the database, so we have to push a dummy value into $items, or the render system will assume we have nothing to display. See https://api.drupal.org/comment/48043#comment-48043

File

modules/mailchimp_lists/includes/mailchimp_lists.field.inc, line 563
Field hooks.

Code

function mailchimp_lists_field_prepare_view($entity_type, $entities, $field, $instances, $langcode, &$items) {
  if ($field['type'] == 'mailchimp_lists_subscription') {
    foreach ($items as $key => $item) {
      $items[$key][0]['value'] = 'Dummy value';
    }
  }
}