class Timeline in Views TimelineJS integration 7.3
Defines a TimelineJS3 timeline.
Hierarchy
- class \Timeline implements TimelineInterface
Expanded class hierarchy of Timeline
File
- src/
Timeline.php, line 6
View source
class Timeline implements TimelineInterface {
/**
* The timeline scale.
*
* @var string
*/
protected $scale = 'human';
/**
* The timeline's title slide.
*
* @var TimelineSlideInterface
*/
protected $title_slide;
/**
* The timeline's array of event slides.
*
* @var array
*/
protected $events = array();
/**
* The timeline's array of eras.
*
* @var array
*/
protected $eras = array();
/**
* {@inheritdoc}
*/
public function setTitleSlide(\TimelineSlideInterface $slide) {
$this->title_slide = $slide;
}
/**
* {@inheritdoc}
*/
public function getTitleSlide() {
return $this->title_slide;
}
/**
* {@inheritdoc}
*/
public function addEvent(\TimelineSlideInterface $slide) {
$this->events[] = $slide;
}
/**
* {@inheritdoc}
*/
public function getEvents() {
return $this->events;
}
/**
* {@inheritdoc}
*/
public function addEra(\TimelineEraInterface $era) {
$this->eras[] = $era;
}
/**
* {@inheritdoc}
*/
public function getEras() {
return $this->eras;
}
/**
* {@inheritdoc}
*/
public function setScaleToHuman() {
$this->scale = 'human';
}
/**
* {@inheritdoc}
*/
public function setScaleToCosomological() {
$this->scale = 'cosomological';
}
/**
* {@inheritdoc}
*/
public function getScale() {
return $this->scale;
}
/**
* {@inheritdoc}
*/
public function buildArray() {
$timeline = array(
'scale' => $this->scale,
);
if (!empty($this->title_slide)) {
$timeline['title'] = $this->title_slide
->buildArray();
}
foreach ($this->events as $event) {
$timeline['events'][] = $event
->buildArray();
}
foreach ($this->eras as $era) {
$timeline['eras'][] = $era
->buildArray();
}
return $timeline;
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Timeline:: |
protected | property | The timeline's array of eras. | |
Timeline:: |
protected | property | The timeline's array of event slides. | |
Timeline:: |
protected | property | The timeline scale. | |
Timeline:: |
protected | property | The timeline's title slide. | |
Timeline:: |
public | function |
Adds a new era to the timeline's eras array. Overrides TimelineInterface:: |
|
Timeline:: |
public | function |
Adds a new slide to the timeline's events array. Overrides TimelineInterface:: |
|
Timeline:: |
public | function |
Creates an array representing the TimelineJS javascript object. Overrides TimelineObjectInterface:: |
|
Timeline:: |
public | function |
Returns the timeline's array of eras. Overrides TimelineInterface:: |
|
Timeline:: |
public | function |
Returns the timeline's array of event slides. Overrides TimelineInterface:: |
|
Timeline:: |
public | function |
Returns the timeline's scale. Overrides TimelineInterface:: |
|
Timeline:: |
public | function |
Returns the timeline's title slide. Overrides TimelineInterface:: |
|
Timeline:: |
public | function |
Sets the timeline's scale to cosmological. Overrides TimelineInterface:: |
|
Timeline:: |
public | function |
Sets the timeline's scale to human. Overrides TimelineInterface:: |
|
Timeline:: |
public | function |
Sets the timeline's title slide. Overrides TimelineInterface:: |