You are here

function data_entity_views_default_views_alter in Data 7

Implements hook_views_default_views_alter().

Add our field to the default data table views, when the data table is declared as an entity type.

File

data_entity/views/data_entity.views.inc, line 35
Contains Views hooks.

Code

function data_entity_views_default_views_alter(&$views) {
  $tables = data_entity_get_entity_tables();
  foreach ($tables as $table) {
    $view_name = $table_name = $table
      ->get('name');

    // Not all tables have views, eg if they have no primary key.
    if (isset($views[$view_name])) {
      $view = $views[$view_name];
      $handler =& $view->display['default']->handler;

      /* Field: User: Name */
      $handler->display->display_options['fields']['edit_link']['id'] = 'edit_link';
      $handler->display->display_options['fields']['edit_link']['table'] = $table_name;
      $handler->display->display_options['fields']['edit_link']['field'] = 'edit_link';
    }
  }
}