Projet

Général

Profil

Paste
Télécharger (1,63 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / views_bulk_operations / views / views_bulk_operations.views.inc @ 9a28ac3f

1
<?php
2

    
3
/**
4
 * Implements hook_views_data_alter().
5
 */
6
function views_bulk_operations_views_data_alter(&$data) {
7
  foreach (entity_get_info() as $entity_type => $info) {
8
    if (isset($info['base table']) && isset($data[$info['base table']]['table'])) {
9
      $data[$info['base table']]['views_bulk_operations']['moved to'] = array('views_entity_' . $entity_type, 'views_bulk_operations');
10
      $data['views_entity_' . $entity_type]['views_bulk_operations'] = array(
11
        'title' => $data[$info['base table']]['table']['group'],
12
        'group' => t('Bulk operations'),
13
        'help' => t('Provide a checkbox to select the row for bulk operations.'),
14
        'real field' => $info['entity keys']['id'],
15
        'field' => array(
16
          'handler' => 'views_bulk_operations_handler_field_operations',
17
          'click sortable' => FALSE,
18
        ),
19
      );
20
      // Check that the base table has the entity type key set.
21
      if (!isset($data[$info['base table']]['table']['entity type'])) {
22
        $data[$info['base table']]['table']['entity type'] = $entity_type;
23
      }
24
    }
25
    if (isset($info['revision table']) && isset($data[$info['revision table']]['table'])) {
26
      $data[$info['revision table']]['views_bulk_operations'] = array(
27
        'title' => $data[$info['revision table']]['table']['group'],
28
        'group' => t('Bulk operations'),
29
        'help' => t('Provide a checkbox to select the row for bulk operations.'),
30
        'real field' => $info['entity keys']['revision'],
31
        'field' => array(
32
          'handler' => 'views_bulk_operations_handler_field_operations',
33
          'click sortable' => FALSE,
34
        ),
35
      );
36
    }
37
  }
38
}