You are here

class TitleSlide in Views TimelineJS integration 8.3

Defines a TimelineJS3 title slide.

Hierarchy

Expanded class hierarchy of TitleSlide

1 file declares its use of TitleSlide
TimelineJS.php in src/Plugin/views/style/TimelineJS.php

File

src/TimelineJS/TitleSlide.php, line 8

Namespace

Drupal\views_timelinejs\TimelineJS
View source
class TitleSlide extends Slide {

  /**
   * Constructs a new TitleSlide object.
   *
   * @param \Drupal\views_timelinejs\TimelineJS\TextInterface|null $text
   *   Text to display on the title slide.
   */
  public function __construct(TextInterface $text = NULL) {
    if (!empty($text)) {
      $this->text = $text;
    }
  }

  /**
   * {@inheritdoc}
   */
  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);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Slide::$autolink protected property The slide autolink property.
Slide::$background protected property The slide background url and color.
Slide::$displayDate protected property The slide display date.
Slide::$endDate protected property The slide end date.
Slide::$group protected property The slide group.
Slide::$media protected property The slide media and its metadata.
Slide::$startDate protected property The slide start date.
Slide::$text protected property The slide headline and text.
Slide::$uniqueId protected property The slide unique id.
Slide::disableAutolink public function Sets the slide's autolink property to FALSE. Overrides SlideInterface::disableAutolink
Slide::enableAutolink public function Sets the slide's autolink property to TRUE. Overrides SlideInterface::enableAutolink
Slide::setBackground public function Sets the background for this slide. Overrides SlideInterface::setBackground
Slide::setDisplayDate public function Sets the display date for this slide. Overrides SlideInterface::setDisplayDate
Slide::setGroup public function Sets the group for this slide. Overrides SlideInterface::setGroup
Slide::setMedia public function Sets the media for this slide. Overrides SlideInterface::setMedia
Slide::setUniqueId public function Sets the unique ID for this slide. Overrides SlideInterface::setUniqueId
TitleSlide::buildArray public function Creates an array representing the TimelineJS javascript object. Overrides Slide::buildArray
TitleSlide::__construct public function Constructs a new TitleSlide object. Overrides Slide::__construct