@ -13,13 +13,16 @@ function islandora_views_data_alter(&$data) {
$fields = \Drupal::service('entity_field.manager')->getFieldStorageDefinitions('node');
$fields = \Drupal::service('entity_field.manager')->getFieldStorageDefinitions('node');
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) {
$data['node__' . $field][$field . '_value']['field'] = $data['node__' . $field][$field]['field'];
$prefixed_field = 'node__' . $field;
$data['node__' . $field][$field]['title'] = t('Integer Weight Selector (@field)', [
if (isset($data[$prefixed_field])) {
$data[$prefixed_field][$field . '_value']['field'] = $data[$prefixed_field][$field]['field'];
$data[$prefixed_field][$field]['title'] = t('Integer Weight Selector (@field)', [
'@field' => $field,
'@field' => $field,
]);
]);
$data['node__' . $field][$field]['help'] = t('Provides a drag-n-drop reordering of integer-based weight fields.');
$data[$prefixed_field][$field]['help'] = t('Provides a drag-n-drop reordering of integer-based weight fields.');
$data['node__' . $field][$field]['title short'] = t('Integer weight selector');
$data[$prefixed_field][$field]['title short'] = t('Integer weight selector');
$data['node__' . $field][$field]['field']['id'] = 'integer_weight_selector';
$data[$prefixed_field][$field]['field']['id'] = 'integer_weight_selector';
}
}
}
}
}
}
}