You are here

public function Era::buildArray in Views TimelineJS integration 8.3

Creates an array representing the TimelineJS javascript object.

Return value

mixed[] The formatted array.

Overrides ObjectInterface::buildArray

File

src/TimelineJS/Era.php, line 52

Class

Era
Defines a TimelineJS3 era.

Namespace

Drupal\views_timelinejs\TimelineJS

Code

public function buildArray() {
  $era = [
    'start_date' => $this->startDate
      ->buildArray(),
    'end_date' => $this->endDate
      ->buildArray(),
  ];
  if (!empty($this->text)) {
    $era['text'] = $this->text
      ->buildArray();
  }
  return $era;
}