TimelineEra.php in Views TimelineJS integration 7.3
File
src/TimelineEra.php
View source
<?php
class TimelineEra implements TimelineEraInterface {
protected $start_date;
protected $end_date;
protected $text;
public function __construct(TimelineDateInterface $start_date, TimelineDateInterface $end_date, TimelineTextInterface $text = NULL) {
$this->start_date = $start_date;
$this->end_date = $end_date;
if (!empty($text)) {
$this->text = $text;
}
}
public function buildArray() {
$era = array(
'start_date' => $this->start_date
->buildArray(),
'end_date' => $this->end_date
->buildArray(),
);
if (!empty($this->text)) {
$era['text'] = $this->text
->buildArray();
}
return $era;
}
}