You are here

protected function TimeRangeFormatter::getSplitFormat in Opigno calendar 8

Same name and namespace in other branches
  1. 3.x src/Plugin/Field/FieldFormatter/TimeRangeFormatter.php \Drupal\opigno_calendar\Plugin\Field\FieldFormatter\TimeRangeFormatter::getSplitFormat()

Splits the datetime format into the date and time components.

Return value

array An associative array of date formats keyed by "date" or "time" keys.

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

File

src/Plugin/Field/FieldFormatter/TimeRangeFormatter.php, line 80

Class

TimeRangeFormatter
Time range with optional date formatter.

Namespace

Drupal\opigno_calendar\Plugin\Field\FieldFormatter

Code

protected function getSplitFormat() {
  $parts = explode($this
    ->getSetting('time_separator'), $this
    ->getSetting('date_format'), 2);
  return [
    'date' => $parts[0],
    'time' => $parts[1],
  ];
}