I am unable to find a way to have the calendar events open in the same window. They keep opening new tabs. Would prefer this not to happen.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

eahonet created an issue. See original summary.

turbogeek’s picture

It's possible to set various calendar options after it has been initialized. I was able to remove the setting that opened it in a new tab as defined in the module (js/fullcalendar_view.js). See more info here: https://fullcalendar.io/docs/dynamic-options

$('#calendar').fullCalendar('option', {
  eventClick: function(calEvent, jsEvent, view) {
    if (drupalSettings.linkToEntity) {
      if (calEvent.url) {
        return true;
      }
    }

    return false;
  }
});
eahonet’s picture

I ran into the same need. Did not want to open every calendar item in a new tab. Attached is my attempt at a patch that will give you a new checkbox under Fullcalendar View > Settings > Display section with the title "Open entities (calendar items) into new tabs". It defaults to opening in a new tab as is the current behavior, but allows you to uncheck it to have it open in the same tab.

Thank you for pointing me in the correct direction @turbogeek in #2

Mingsong’s picture

Thanks for the patch.

I will test and merge it with next release.

Cheers,

mmjvb’s picture

Status: Active » Needs review

Patch provided, so Needs review.

jeremyr’s picture

Status: Needs review » Reviewed & tested by the community

Tested the patch, works as described.

Provides a new checkbox in the view format and is checked by default (so that opens in a new window like it always has).

For anyone applying this patch, make sure you run a cache rebuild.

piridium’s picture

Tested the patch, too. Works as described. Thanks @eahonet!

dak5859’s picture

Version: 8.x-2.x-dev » 8.x-2.2
FileSize
17.68 KB

I just tested this patch on 8.x-2.2 and when I uncheck the checkbox for opening events in new window it doesn't save that setting. Just remains checked. I also tested in 8.x-2.x-dev version with the same results. I'm on Drupal 8.6.16.

dak5859’s picture

Version: 8.x-2.2 » 8.x-2.x-dev
dak5859’s picture

Can anyone else confirm this patch is working as expected. Again - when testing this patch on 8.x-2.2 version of this module - the setting was available - but would not allow me to uncheck and save the setting. It remained checked even after save. So event calendar links continue to open event nodes in new windows.

dak5859’s picture

Version: 8.x-2.x-dev » 8.x-2.2
Status: Reviewed & tested by the community » Needs review
FileSize
481 bytes

Adding a new patch based on turbogeek's solution in comment #2 above that will resolve this issue as well. This would be used as an alternative patch to #3. Again, when applying the patch provided by eahonet in comment #3 above, the new "Open entities (calendar items) into new tabs" setting was available under Fullcalender view "Display" settings as described, but it would not allow me to uncheck it and save it in my calendar view.

Mingsong’s picture

Thanks for the patches and testing work.

The issue raised by dak5859 at #8 is caused by following codes:

'#default_value' => (empty($this->options['openEntityInNewTab'])) ? 1 : $this->options['openEntityInNewTab'],

It should be replaced with following

'#default_value' => !isset($this->options['openEntityInNewTab']) ? 1 : $this->options['openEntityInNewTab'],

  • eahonet authored a159a7a on 8.x-2.x
    Issue #3007409 by dak5859, eahonet, Mingsong: Option to not have items...
DamienMcKenna’s picture

Status: Needs review » Fixed

This was committed and is available in the 8.x-2.3 release.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.