You are here

function hook_duration_field_separators in Duration Field 8

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

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

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

Return value

array An array of separators to be used between time values when displaying the duration value. Keys should be the machine name of the separator, with values being the actual separator that should be used. Note that keys are arbitrary, but need to be the same as the machine name keys used in hook_duration_field_labels().

2 invocations of hook_duration_field_separators()
DurationHumanDisplayFormatter::getSeparator in src/Plugin/Field/FieldFormatter/DurationHumanDisplayFormatter.php
Converts the key for a separator between values.
DurationHumanDisplayFormatter::settingsForm in src/Plugin/Field/FieldFormatter/DurationHumanDisplayFormatter.php
Returns a form to configure settings for the formatter.

File

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

Code

function hook_duration_field_separators() {
  return [
    'asterisks' => '***',
    'hashes' => '###',
  ];
}