You are here

function hook_duration_field_labels in Duration Field 8

Same name and namespace in other branches
  1. 8.2 duration_field.api.php \hook_duration_field_labels()
  2. 3.0.x duration_field.api.php \hook_duration_field_labels()

Add custom field separators to be used by the Duration Field module.

Note that if this hook is implemented, hook_duration_field_separators() is also required to be implemented.

Return value

array An array with two keys, 'capitalized' and 'lowercase'. Each element of this array should be an array, whose keys are the machine names specified in hook_duration_field_separators() with the value being the translated name of the separator. This means that each machine name will exist in both the 'capitalized' and the 'lowercase' elements of the return array.

1 invocation of hook_duration_field_labels()
DurationHumanDisplayFormatter::getHumanFriendlyLabel in src/Plugin/Field/FieldFormatter/DurationHumanDisplayFormatter.php
Converts a key to a human readable value.

File

./duration_field.api.php, line 41
Contains hook examples for the Duration Field module.

Code

function hook_duration_field_labels() {
  return [
    'capitalized' => [
      'asterisks' => t('Asterisks'),
      'hashes' => t('Hashes'),
    ],
    'lowercase' => [
      'asterisks' => t('asterisks'),
      'hashes' => t('hashes'),
    ],
  ];
}