function efq_views_views_data in EntityFieldQuery Views Backend 7
Implements hook_views_data().
File
- ./
efq_views.views.inc, line 6
Code
function efq_views_views_data() {
$data = array();
$entity_info = entity_get_info();
foreach (entity_views_data() as $key => $entity_data) {
if ($key == 'entity__global') {
continue;
}
if (_efq_views_copy_data($data, $entity_type, $key, $entity_data)) {
$metadata = entity_get_property_info($entity_type);
$fields = array();
// Collect the fields.
foreach (field_info_instances($entity_type) as $field_data) {
$fields += array_flip(array_keys($field_data));
}
$info = $entity_info[$entity_type];
foreach ($data['efq_' . $entity_type] as $index => &$views_data) {
unset($views_data['relationship']);
if (isset($fields[$index]) || isset($views_data['real field'])) {
_efq_views_get_field_handlers($views_data, $index);
}
else {
$move = _efq_views_get_property_handlers($views_data, $index, $metadata, $info);
if ($move) {
$data['efq_' . $entity_type][$move] = $views_data;
unset($data['efq_' . $entity_type][$index]);
}
}
}
$data['efq_' . $entity_type]['table']['entity type'] = $entity_type;
$data['efq_' . $entity_type]['table']['base'] = array(
'title' => 'EntityFieldQuery: ' . $info['label'],
'help' => t('Uses EntityFieldQuery for querying the !type entity type', array(
'!type' => $entity_type,
)),
'query class' => 'efq_query',
'field' => $info['entity keys']['id'],
);
$data['efq_' . $entity_type] += _efq_views_get_entity_data($entity_type, $info);
// Add optional support for Views Bulk Operations.
if (module_exists('views_bulk_operations')) {
$data['efq_' . $entity_type]['views_bulk_operations'] = array(
'title' => $data['efq_' . $entity_type]['table']['base']['title'],
'group' => t('Bulk operations'),
'help' => t('Provide a checkbox to select the row for bulk operations.'),
'real field' => $entity_info[$entity_type]['entity keys']['id'],
'field' => array(
'handler' => 'efq_views_handler_field_operations',
'click sortable' => FALSE,
),
);
}
}
}
return $data;
}