Skip to content

Commit

Permalink
Issue #2461913 by slashrsm: Add entity browser select form to entity …
Browse files Browse the repository at this point in the history
…data table.
  • Loading branch information
slashrsm committed Mar 29, 2015
1 parent 57e2f75 commit 96e73c3
Showing 1 changed file with 25 additions and 10 deletions.
35 changes: 25 additions & 10 deletions entity_browser.views.inc
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,36 @@
*/

/**
* Implements hook_views_data_alter().
*/
* Implements hook_views_data_alter().
*/
function entity_browser_views_data_alter(&$data) {
$entity_manager = \Drupal::entityManager();
foreach ($entity_manager->getDefinitions() as $entity_type_name => $entity_type) {
if (!empty($data[$entity_type->getBaseTable()])) {
$entity_keys = $entity_type->get('entity_keys');
$data[$entity_type->getBaseTable()]['entity_browser_select'] = [
'title' => t('Entity browser bulk select form'),
'help' => t('Add a form element that lets you use a view as a base to select entities in entity browser.'),
'field' => [
'id' => 'entity_browser_select',
'real field' => $entity_keys['id'],
],
];

if ($base_table = $entity_type->getBaseTable()) {
$data[$base_table]['entity_browser_select'] = [
'title' => t('Entity browser bulk select form'),
'help' => t('Add a form element that lets you use a view as a base to select entities in entity browser.'),
'field' => [
'id' => 'entity_browser_select',
'real field' => $entity_keys['id'],
],
];
}

if ($data_table = $entity_type->getDataTable()) {
$data[$data_table]['entity_browser_select'] = [
'title' => t('Entity browser bulk select form'),
'help' => t('Add a form element that lets you use a view as a base to select entities in entity browser.'),
'field' => [
'id' => 'entity_browser_select',
'real field' => $entity_keys['id'],
],
];
}

}
}
}

0 comments on commit 96e73c3

Please sign in to comment.