You are here

protected function views_timelinejs_plugin_style_timelinejs::build_era in Views TimelineJS integration 7.3

Builds a timeline era from the current views data row.

Return value

TimelineEra|NULL An era object or NULL if the start or end date could not be parsed.

1 call to views_timelinejs_plugin_style_timelinejs::build_era()
views_timelinejs_plugin_style_timelinejs::render in ./views_timelinejs_plugin_style_timelinejs.inc
Render the display in this style.

File

./views_timelinejs_plugin_style_timelinejs.inc, line 445

Class

views_timelinejs_plugin_style_timelinejs
Style plugin to render items as TimelineJS3 slides.

Code

protected function build_era() {
  $start_date = $this
    ->build_date($this->options['timeline_fields']['start_date']);

  // Return NULL if the era has no start date.
  if (empty($start_date)) {
    return NULL;
  }
  $end_date = $this
    ->build_date($this->options['timeline_fields']['end_date']);

  // Return NULL if the era has no end date.
  if (empty($end_date)) {
    return NULL;
  }
  $text = $this
    ->build_text();
  return new TimelineEra($start_date, $end_date, $text);
}