protected function CiviCRMEntityDefaultViewsController::schema_fields in CiviCRM Entity 7
Same name and namespace in other branches
- 7.2 civicrm_entity_default_views_controller.inc \CiviCRMEntityDefaultViewsController::schema_fields()
Find views fields using schema & entity property information.
Overrides EntityDefaultViewsController::schema_fields
1 call to CiviCRMEntityDefaultViewsController::schema_fields()
- CiviCRMEntityDefaultViewsController::views_data in ./
civicrm_entity_default_views_controller.inc - Defines the result for hook_views_data().
File
- ./
civicrm_entity_default_views_controller.inc, line 40
Class
- CiviCRMEntityDefaultViewsController
- @TODO Document this class.
Code
protected function schema_fields() {
// We are not using the 'normal' schema function here due to the
// problems discussed in the readme.
if (empty($this->info['base table'])) {
return array();
}
$schema = civicrm_entity_get_schema($this->info['base table']);
$properties = entity_get_property_info($this->type) + array(
'properties' => array(),
);
$data = array();
// We will take out the reliance on other schema related checks
// here, ideally we would 'read' getfields output to determine if
// we are looking at a DB field or a custom / pseudofield.
foreach ($properties['properties'] as $name => $property_info) {
if (!empty($property_info['schema field']) && !empty($schema['fields']) && 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;
}