class TimelineMedia in Views TimelineJS integration 7.3
Defines a TimelineJS3 media object.
Hierarchy
- class \TimelineMedia implements TimelineMediaInterface
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
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
TimelineMedia:: |
protected | property | The media caption. | |
TimelineMedia:: |
protected | property | The media credit. | |
TimelineMedia:: |
protected | property | The media thumbnail image url. | |
TimelineMedia:: |
protected | property | The media url, blockquote, or iframe. | |
TimelineMedia:: |
public | function |
Creates an array representing the TimelineJS javascript object. Overrides TimelineObjectInterface:: |
|
TimelineMedia:: |
public | function |
Sets the caption for this media. Overrides TimelineMediaInterface:: |
|
TimelineMedia:: |
public | function |
Sets the credit for this media. Overrides TimelineMediaInterface:: |
|
TimelineMedia:: |
public | function |
Sets the thumbnail image URL for this media. Overrides TimelineMediaInterface:: |
|
TimelineMedia:: |
public | function |