class Background in Views TimelineJS integration 8.3
Defines a TimelineJS3 background object.
Hierarchy
- class \Drupal\views_timelinejs\TimelineJS\Background implements BackgroundInterface
Expanded class hierarchy of Background
1 file declares its use of Background
- TimelineJS.php in src/
Plugin/ views/ style/ TimelineJS.php
File
- src/
TimelineJS/ Background.php, line 8
Namespace
Drupal\views_timelinejs\TimelineJSView source
class Background implements BackgroundInterface {
/**
* The background image url.
*
* @var string
*/
protected $url;
/**
* The background color.
*
* A CSS color, in hexadecimal (e.g. #0f9bd1) or a valid CSS color keyword.
*
* @var string
*/
protected $color;
/**
* Constructs a new Background object.
*
* @param string $url
* The background image URL.
* @param string $color
* The background color.
*/
public function __construct($url = '', $color = '') {
$this->url = $url;
$this->color = $color;
}
/**
* {@inheritdoc}
*/
public function buildArray() {
$background = [];
if (!empty($this->url)) {
$background['url'] = $this->url;
}
if (!empty($this->color)) {
$background['color'] = $this->color;
}
return $background;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Background:: |
protected | property | The background color. | |
Background:: |
protected | property | The background image url. | |
Background:: |
public | function |
Creates an array representing the TimelineJS javascript object. Overrides ObjectInterface:: |
|
Background:: |
public | function | Constructs a new Background object. |