class Era in Views TimelineJS integration 8.3
Defines a TimelineJS3 era.
Hierarchy
- class \Drupal\views_timelinejs\TimelineJS\Era implements EraInterface
Expanded class hierarchy of Era
1 file declares its use of Era
- TimelineJS.php in src/
Plugin/ views/ style/ TimelineJS.php
File
- src/
TimelineJS/ Era.php, line 8
Namespace
Drupal\views_timelinejs\TimelineJSView source
class Era implements EraInterface {
/**
* The era start date.
*
* @var \Drupal\views_timelinejs\TimelineJS\DateInterface
*/
protected $startDate;
/**
* The era end date.
*
* @var \Drupal\views_timelinejs\TimelineJS\DateInterface
*/
protected $endDate;
/**
* The era headline and text.
*
* @var \Drupal\views_timelinejs\TimelineJS\TextInterface
*/
protected $text;
/**
* Constructs a new Era object.
*
* @param \Drupal\views_timelinejs\TimelineJS\DateInterface $start_date
* The era's start date.
* @param \Drupal\views_timelinejs\TimelineJS\DateInterface $end_date
* The era's end date.
* @param \Drupal\views_timelinejs\TimelineJS\TextInterface|null $text
* Text to display on the era.
*/
public function __construct(DateInterface $start_date, DateInterface $end_date, TextInterface $text = NULL) {
$this->startDate = $start_date;
$this->endDate = $end_date;
if (!empty($text)) {
$this->text = $text;
}
}
/**
* {@inheritdoc}
*/
public function buildArray() {
$era = [
'start_date' => $this->startDate
->buildArray(),
'end_date' => $this->endDate
->buildArray(),
];
if (!empty($this->text)) {
$era['text'] = $this->text
->buildArray();
}
return $era;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Era:: |
protected | property | The era end date. | |
Era:: |
protected | property | The era start date. | |
Era:: |
protected | property | The era headline and text. | |
Era:: |
public | function |
Creates an array representing the TimelineJS javascript object. Overrides ObjectInterface:: |
|
Era:: |
public | function | Constructs a new Era object. |