You are here

public function TitleSlide::buildArray in Views TimelineJS integration 8.3

Creates an array representing the TimelineJS javascript object.

Return value

mixed[] The formatted array.

Overrides Slide::buildArray

File

src/TimelineJS/TitleSlide.php, line 25

Class

TitleSlide
Defines a TimelineJS3 title slide.

Namespace

Drupal\views_timelinejs\TimelineJS

Code

public function buildArray() {
  $slide = [];
  if (!empty($this->text)) {
    $slide['text'] = $this->text
      ->buildArray();
  }
  if (!empty($this->media)) {
    $slide['media'] = $this->media
      ->buildArray();
  }
  if (!empty($this->background)) {
    $slide['background'] = $this->background
      ->buildArray();
  }
  if (!$this->autolink) {
    $slide['autolink'] = FALSE;
  }
  if (!empty($this->uniqueId)) {
    $slide['unique_id'] = $this->uniqueId;
  }

  // Filter any empty values before returning.
  return array_filter($slide);
}