Completed
Push — 8.x-1.x ( dd95fe...54b5d9 )
by Janez
02:56
created

entity_browser.views.inc::entity_browser_views_data_alter()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 15
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 10
nc 3
nop 1
dl 0
loc 15
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * @file
5
 * Provide views data for entity_browser.module.
6
 */
7
8
/**
9
 * Implements hook_views_data_alter().
10
 */
11
function entity_browser_views_data_alter(&$data) {
12
  foreach (\Drupal::entityTypeManager()->getDefinitions() as $entity_type_name => $entity_type) {
13
    if ($base_table = $entity_type->getBaseTable()) {
14
      $entity_keys = $entity_type->get('entity_keys');
15
      $data[$base_table]['entity_browser_select'] = [
16
        'title' => t('Entity browser bulk select form'),
17
        'help' => t('Add a form element that lets you use a view as a base to select entities in entity browser.'),
18
        'field' => [
19
          'id' => 'entity_browser_select',
20
          'real field' => $entity_keys['id'],
21
        ],
22
      ];
23
    }
24
  }
25
}
26