You are here

protected function EntityDefaultViewsController::schema_revision_fields in Entity API 7

Try to come up with some views fields with the help of the revision schema and the entity property information.

1 call to EntityDefaultViewsController::schema_revision_fields()
EntityDefaultViewsController::views_data in views/entity.views.inc
Defines the result for hook_views_data().

File

views/entity.views.inc, line 462
Provide views data for modules making use of the entity CRUD API.

Class

EntityDefaultViewsController
Default controller for generating basic views integration.

Code

protected function schema_revision_fields() {
  $data = array();
  if (!empty($this->info['revision table'])) {
    $schema = drupal_get_schema($this->info['revision table']);
    $properties = entity_get_property_info($this->type) + array(
      'properties' => array(),
    );
    foreach ($properties['properties'] as $name => $property_info) {
      if (isset($property_info['schema field']) && isset($schema['fields'][$property_info['schema field']])) {
        if ($views_info = $this
          ->map_from_schema_info($name, $schema['fields'][$property_info['schema field']], $property_info)) {
          $data[$name] = $views_info;
        }
      }
    }
  }
  return $data;
}