You are here

protected function DurationHumanDisplayFormatter::getSeparator in Duration Field 3.0.x

Same name and namespace in other branches
  1. 8.2 src/Plugin/Field/FieldFormatter/DurationHumanDisplayFormatter.php \Drupal\duration_field\Plugin\Field\FieldFormatter\DurationHumanDisplayFormatter::getSeparator()
  2. 8 src/Plugin/Field/FieldFormatter/DurationHumanDisplayFormatter.php \Drupal\duration_field\Plugin\Field\FieldFormatter\DurationHumanDisplayFormatter::getSeparator()

Converts the key for a separator between values.

Return value

string The value to be inserted between returned elements

1 call to DurationHumanDisplayFormatter::getSeparator()
DurationHumanDisplayFormatter::viewElements in src/Plugin/Field/FieldFormatter/DurationHumanDisplayFormatter.php
Builds a renderable array for a field value.

File

src/Plugin/Field/FieldFormatter/DurationHumanDisplayFormatter.php, line 245

Class

DurationHumanDisplayFormatter
Provides a human friendly formatter for the Duration field type.

Namespace

Drupal\duration_field\Plugin\Field\FieldFormatter

Code

protected function getSeparator() {
  $custom_separators = $this->moduleHandler
    ->invokeAll('duration_field_separators');
  $separators = [
    'space' => ' ',
    'hyphen' => ' - ',
    'comma' => ', ',
    'newline' => '<br />',
  ] + $custom_separators;
  return $separators[$this
    ->getSetting('separator')];
}