|
|
@ -9,19 +9,21 @@ |
|
|
|
* 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) { |
|
|
|
foreach ($fields as $field => $field_storage_definition) { |
|
|
|
$fields = \Drupal::service('entity_field.manager')->getFieldStorageDefinitions($entity_type); |
|
|
|
if ($field_storage_definition->getType() == 'integer' && strpos($field, "field_") === 0) { |
|
|
|
foreach ($fields as $field => $field_storage_definition) { |
|
|
|
$prefixed_field = 'node__' . $field; |
|
|
|
if ($field_storage_definition->getType() == 'integer' && strpos($field, "field_") === 0) { |
|
|
|
if (isset($data[$prefixed_field])) { |
|
|
|
$prefixed_field = $entity_type . '__' . $field; |
|
|
|
$data[$prefixed_field][$field . '_value']['field'] = $data[$prefixed_field][$field]['field']; |
|
|
|
if (isset($data[$prefixed_field])) { |
|
|
|
$data[$prefixed_field][$field]['title'] = t('Integer Weight Selector (@field)', [ |
|
|
|
$data[$prefixed_field][$field . '_value']['field'] = $data[$prefixed_field][$field]['field']; |
|
|
|
'@field' => $field, |
|
|
|
$data[$prefixed_field][$field]['title'] = t('Integer Weight Selector (@field)', [ |
|
|
|
]); |
|
|
|
'@field' => $field, |
|
|
|
$data[$prefixed_field][$field]['help'] = t('Provides a drag-n-drop reordering of integer-based weight fields.'); |
|
|
|
]); |
|
|
|
$data[$prefixed_field][$field]['title short'] = t('Integer weight selector'); |
|
|
|
$data[$prefixed_field][$field]['help'] = t('Provides a drag-n-drop reordering of integer-based weight fields.'); |
|
|
|
$data[$prefixed_field][$field]['field']['id'] = 'integer_weight_selector'; |
|
|
|
$data[$prefixed_field][$field]['title short'] = t('Integer weight selector'); |
|
|
|
|
|
|
|
$data[$prefixed_field][$field]['field']['id'] = 'integer_weight_selector'; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|