|
|
@ -9,11 +9,12 @@ |
|
|
|
* Implements hook_views_data_alter(). |
|
|
|
* Implements hook_views_data_alter(). |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
function islandora_views_data_alter(&$data) { |
|
|
|
function islandora_views_data_alter(&$data) { |
|
|
|
// For now only support Nodes. |
|
|
|
// For now only support Nodes and Media. |
|
|
|
$fields = \Drupal::service('entity_field.manager')->getFieldStorageDefinitions('node'); |
|
|
|
foreach (['node', 'media'] as $entity_type) { |
|
|
|
|
|
|
|
$fields = \Drupal::service('entity_field.manager')->getFieldStorageDefinitions($entity_type); |
|
|
|
foreach ($fields as $field => $field_storage_definition) { |
|
|
|
foreach ($fields as $field => $field_storage_definition) { |
|
|
|
if ($field_storage_definition->getType() == 'integer' && strpos($field, "field_") === 0) { |
|
|
|
if ($field_storage_definition->getType() == 'integer' && strpos($field, "field_") === 0) { |
|
|
|
$prefixed_field = 'node__' . $field; |
|
|
|
$prefixed_field = $entity_type . '__' . $field; |
|
|
|
if (isset($data[$prefixed_field])) { |
|
|
|
if (isset($data[$prefixed_field])) { |
|
|
|
$data[$prefixed_field][$field . '_value']['field'] = $data[$prefixed_field][$field]['field']; |
|
|
|
$data[$prefixed_field][$field . '_value']['field'] = $data[$prefixed_field][$field]['field']; |
|
|
|
$data[$prefixed_field][$field]['title'] = t('Integer Weight Selector (@field)', [ |
|
|
|
$data[$prefixed_field][$field]['title'] = t('Integer Weight Selector (@field)', [ |
|
|
@ -25,6 +26,7 @@ function islandora_views_data_alter(&$data) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Add Has Media filter. |
|
|
|
// Add Has Media filter. |
|
|
|
$data['node_field_data']['islandora_has_media'] = [ |
|
|
|
$data['node_field_data']['islandora_has_media'] = [ |
|
|
|