function multiversion_views_data_alter in Multiversion 8
Implements hook_views_data_alter().
File
- ./
multiversion.module, line 357
Code
function multiversion_views_data_alter(array &$data) {
foreach ($data as $key => $item) {
// Set standard handler for _rev field.
if (isset($data[$key]['_rev'])) {
$data[$key]['_rev']['field']['id'] = 'standard';
}
if (isset($data[$key]['_deleted'])) {
// Use status = 1 instead of status <> 0 in WHERE statement.
$data[$key]['_deleted']['filter']['use_equal'] = TRUE;
}
// Add a new filter that filters content by current active workspace.
if (isset($data[$key]['workspace'])) {
$data[$key]['current_workspace'] = [
'title' => t('Current workspace'),
'help' => t('Filters content by current active workspace.'),
'filter' => [
'field' => 'workspace',
'id' => 'current_workspace',
'label' => t('Current workspace'),
],
];
// Unset the 'Workspace reference' filter because users are not allowed to
// filter by a specific workspace, other than current active workspace.
// To filter by current active workspace will be used the 'Current workspace'
// filter.
unset($data[$key]['workspace']);
}
}
}