class Media in Views TimelineJS integration 8.3
Defines a TimelineJS3 media object.
Hierarchy
- class \Drupal\views_timelinejs\TimelineJS\Media implements MediaInterface
Expanded class hierarchy of Media
1 file declares its use of Media
- TimelineJS.php in src/Plugin/ views/ style/ TimelineJS.php 
1 string reference to 'Media'
- TimelineJS::buildOptionsForm in src/Plugin/ views/ style/ TimelineJS.php 
- Provide a form to edit options for this plugin.
File
- src/TimelineJS/ Media.php, line 8 
Namespace
Drupal\views_timelinejs\TimelineJSView source
class Media implements MediaInterface {
  /**
   * 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;
  /**
   * Constructs a new Media object.
   *
   * @param string $url
   *   The URL of the media resource.
   */
  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 = [
      '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
| Name   | Modifiers | Type | Description | Overrides | 
|---|---|---|---|---|
| Media:: | protected | property | The media caption. | |
| Media:: | protected | property | The media credit. | |
| Media:: | protected | property | The media thumbnail image url. | |
| Media:: | protected | property | The media url, blockquote, or iframe. | |
| Media:: | public | function | Creates an array representing the TimelineJS javascript object. Overrides ObjectInterface:: | |
| Media:: | public | function | Sets the caption for this media. Overrides MediaInterface:: | |
| Media:: | public | function | Sets the credit for this media. Overrides MediaInterface:: | |
| Media:: | public | function | Sets the thumbnail image URL for this media. Overrides MediaInterface:: | |
| Media:: | public | function | Constructs a new Media object. | 
