protected function TimelineJS::buildSlide in Views TimelineJS integration 8.3
Builds a timeline slide from the current views data row.
Return value
\Drupal\views_timelinejs\TimelineJS\Slide|null A slide object or NULL if the start date could not be parsed.
1 call to TimelineJS::buildSlide()
- TimelineJS::render in src/
Plugin/ views/ style/ TimelineJS.php - Render the display in this style.
File
- src/
Plugin/ views/ style/ TimelineJS.php, line 445
Class
- TimelineJS
- Style plugin to render items as TimelineJS3 slides.
Namespace
Drupal\views_timelinejs\Plugin\views\styleCode
protected function buildSlide() {
$start_date = $this
->buildDate($this->options['timeline_fields']['start_date']);
// Return NULL if the slide has no start date.
if (empty($start_date)) {
return NULL;
}
$end_date = $this
->buildDate($this->options['timeline_fields']['end_date']);
$text = $this
->buildText();
$slide = new Slide($start_date, $end_date, $text);
// Check to see if this slide should be the start slide.
$this
->checkStartSlide($start_date);
$slide
->setDisplayDate($this
->buildDisplayDate());
$slide
->setGroup($this
->buildGroup());
$slide
->setBackground($this
->buildBackground());
$media = $this
->buildMedia();
if (!empty($media)) {
$slide
->setMedia($media);
}
$slide
->setUniqueId($this
->buildUniqueId());
return $slide;
}