You are here

protected function EntityDefaultViewsController::schema_fields in Entity API 7

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

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

File

views/entity.views.inc, line 443
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_fields() {
  $schema = drupal_get_schema($this->info['base table']);
  $properties = entity_get_property_info($this->type) + array(
    'properties' => array(),
  );
  $data = 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;
}