You are here

class TimelineMedia in Views TimelineJS integration 7.3

Defines a TimelineJS3 media object.

Hierarchy

Expanded class hierarchy of TimelineMedia

File

src/TimelineMedia.php, line 6

View source
class TimelineMedia implements TimelineMediaInterface {

  /**
   * The media url, blockquote, or iframe.
   *
   * @var string
   */
  protected $url;

  /**
   * The media caption.
   *
   * @var string
   */
  protected $caption;

  /**
   * The media credit.
   *
   * @var string
   */
  protected $credit;

  /**
   * The media thumbnail image url.
   *
   * @var string
   */
  protected $thumbnail;
  public function __construct($url) {
    $this->url = $url;
  }

  /**
   * {@inheritdoc}
   */
  public function setCaption($text) {
    $this->caption = $text;
  }

  /**
   * {@inheritdoc}
   */
  public function setCredit($text) {
    $this->credit = $text;
  }

  /**
   * {@inheritdoc}
   */
  public function setThumbnail($url) {
    $this->thumbnail = $url;
  }

  /**
   * {@inheritdoc}
   */
  public function buildArray() {
    $media = array(
      '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;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
TimelineMedia::$caption protected property The media caption.
TimelineMedia::$credit protected property The media credit.
TimelineMedia::$thumbnail protected property The media thumbnail image url.
TimelineMedia::$url protected property The media url, blockquote, or iframe.
TimelineMedia::buildArray public function Creates an array representing the TimelineJS javascript object. Overrides TimelineObjectInterface::buildArray
TimelineMedia::setCaption public function Sets the caption for this media. Overrides TimelineMediaInterface::setCaption
TimelineMedia::setCredit public function Sets the credit for this media. Overrides TimelineMediaInterface::setCredit
TimelineMedia::setThumbnail public function Sets the thumbnail image URL for this media. Overrides TimelineMediaInterface::setThumbnail
TimelineMedia::__construct public function