You are here

public function Media::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/Media.php, line 72

Class

Media
Defines a TimelineJS3 media object.

Namespace

Drupal\views_timelinejs\TimelineJS

Code

public function buildArray() {
  $media = [
    'url' => $this->url,
  ];
  if (!empty($this->caption)) {
    $media['caption'] = $this->caption;
  }
  if (!empty($this->credit)) {
    $media['credit'] = $this->credit;
  }
  if (!empty($this->thumbnail)) {
    $media['thumbnail'] = $this->thumbnail;
  }
  return $media;
}