protected function TimelineJS::prepareLanguageOption in Views TimelineJS integration 8.3
Sets the timeline language option to the site's current language.
1 call to TimelineJS::prepareLanguageOption()
- TimelineJS::prepareTimelineOptions in src/
Plugin/ views/ style/ TimelineJS.php - Processes timeline options before theming.
File
- src/
Plugin/ views/ style/ TimelineJS.php, line 810
Class
- TimelineJS
- Style plugin to render items as TimelineJS3 slides.
Namespace
Drupal\views_timelinejs\Plugin\views\styleCode
protected function prepareLanguageOption() {
$supported_languages = _views_timelinejs_list_languages();
$language_map = _views_timelinejs_language_map();
$current_language = \Drupal::languageManager()
->getCurrentLanguage()
->getId();
// Check for the site's current language in the list of languages that are
// supported by TimelineJS.
if (isset($supported_languages[$current_language])) {
$this->options['timeline_config']['language'] = $current_language;
}
elseif (isset($language_map[$current_language])) {
$this->options['timeline_config']['language'] = $language_map[$current_language];
}
}