diff --git a/fullcalendar_view.theme.inc b/fullcalendar_view.theme.inc index 76722c8..5972b47 100644 --- a/fullcalendar_view.theme.inc +++ b/fullcalendar_view.theme.inc @@ -15,7 +15,7 @@ use Drupal\Core\Datetime\DrupalDateTime; */ function template_preprocess_views_view_fullcalendar(array &$variables) { global $base_path; - + $view = $variables['view']; $style = $view->style_plugin; $options = $style->options; @@ -316,6 +316,7 @@ function template_preprocess_views_view_fullcalendar(array &$variables) { 'endField' => $end_field, 'rightButtons' => $right_buttons, 'dblClickToCreate' => $dbl_click_to_create, + 'navLinks' => $options['nav_links'], ]; } } diff --git a/js/fullcalendar_view.js b/js/fullcalendar_view.js index 4dd370b..e220c78 100644 --- a/js/fullcalendar_view.js +++ b/js/fullcalendar_view.js @@ -14,18 +14,12 @@ }, defaultDate: drupalSettings.defaultDate, locale: drupalSettings.defaultLang, - navLinks: true, // Can click day/week names to navigate views. + // Can click day/week names to navigate views. + navLinks: (drupalSettings.navLinks == 0) ? false : true, editable: true, eventLimit: true, // Allow "more" link when too many events. events: drupalSettings.fullCalendarView, - eventOverlap: function () { - if (drupalSettings.alloweventOverlap) { - return true; - } - else { - return false; - } - }, + eventOverlap: (drupalSettings.alloweventOverlap == 0) ? false : true, dayClick: dayClickCallback, eventRender: function (event, $el) { // Popup tooltip. diff --git a/src/Plugin/views/style/FullCalendarDisplay.php b/src/Plugin/views/style/FullCalendarDisplay.php index ac52e30..13760b3 100644 --- a/src/Plugin/views/style/FullCalendarDisplay.php +++ b/src/Plugin/views/style/FullCalendarDisplay.php @@ -81,6 +81,7 @@ class FullCalendarDisplay extends StylePluginBase { 'listYear' => 'listYear', ], ]; + $options['nav_links'] = ['default' => 1]; $options['defaultLanguage'] = ['default' => 'en']; $options['languageSelector'] = ['default' => 0]; $options['alloweventOverlap'] = ['default' => 1]; @@ -149,11 +150,19 @@ class FullCalendarDisplay extends StylePluginBase { '#default_value' => (empty($this->options['right_buttons'])) ? [] : $this->options['right_buttons'], '#title' => $this->t('Right side buttons'), ]; + // Nav Links. + $form['nav_links'] = [ + '#type' => 'checkbox', + '#fieldset' => 'display', + '#default_value' => (!isset($this->options['nav_links'])) ? 1 : $this->options['nav_links'], + '#title' => $this->t('Day/Week are links'), + '#description' => t('If this option is selected, day/week names will be linked to navigation views.'), + ]; // Allow/disallow event overlap. $form['alloweventOverlap'] = [ '#type' => 'checkbox', '#fieldset' => 'display', - '#default_value' => (empty($this->options['alloweventOverlap'])) ? 1 : $this->options['alloweventOverlap'], + '#default_value' => (!isset($this->options['alloweventOverlap'])) ? 1 : $this->options['alloweventOverlap'], '#title' => $this->t('Allow calendar events to overlap'), '#description' => t('If this option is selected, calendar events are allowed to overlap (default).'), ];