Projet

Général

Profil

Révision 280fe687

Ajouté par Assos Assos il y a environ 8 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/commerce/modules/customer/includes/views/commerce_customer.views.inc
263 263

  
264 264
  return $data;
265 265
}
266

  
267
/**
268
 * Implements hook_field_views_data().
269
 */
270
function commerce_customer_field_views_data($field) {
271
  $data = field_views_field_default_views_data($field);
272

  
273
  // Build an array of bundles the customer profile reference field appears on.
274
  $bundles = array();
275

  
276
  foreach ($field['bundles'] as $entity => $entity_bundles) {
277
    $bundles[] = $entity . ' (' . implode(', ', $entity_bundles) . ')';
278
  }
279

  
280
  $replacements = array('!field_name' => $field['field_name'], '@bundles' => implode(', ', $bundles));
281

  
282
  foreach ($data as $table_name => $table_data) {
283
    foreach ($table_data as $field_name => $field_data) {
284
      if (isset($field_data['filter']['field_name']) && $field_name != 'delta') {
285
        $data[$table_name][$field_name]['relationship'] = array(
286
          'title' => t('Referenced customer profile'),
287
          'label' => t('Customer profile referenced by !field_name', $replacements),
288
          'help' => t('Relate this entity to the customer profile referenced by its !field_name value.', $replacements) . '<br />' . t('Appears in: @bundles.', $replacements),
289
          'base' => 'commerce_customer_profile',
290
          'base field' => 'profile_id',
291
          'handler' => 'views_handler_relationship',
292
        );
293
      }
294
    }
295
  }
296

  
297
  return $data;
298
}

Formats disponibles : Unified diff