Created on 3 April 2025, 22 days ago

Problem/Motivation

I wanted to alter the start and end datetime using hook_fullcalendar_process_dates_alter(), but it seems the hooks are not firing. I also checked another hook, hook_fullcalendar_editable(), which also didn't fire when I refresh the calendar page. Is it suppose to fire on the event calendar view page?

Steps to reproduce

1. Define a hook in custom module:

/**
 * Implements hook_fullcalendar_process_dates_alter().
 */
function MYMODULE_fullcalendar_process_dates_alter(&$date1, &$date2, &$context)
{
  $logger = \Drupal::logger('mymodule_logger');
  $logger->info('Fullcalendar process dates alter called. Current dates: @date1, @date2', [
    '@date1' => $date1,
    '@date2' => $date2,
  ]);
  ...
}

2. Enable the module, and refresh cache.
3. Visit the calendar page.
4. Don't see log message in the backend. Alterations didn't apply.

It might be a silly mistake, but I have checked other hooks in the same module file and they work as expected.

πŸ› Bug report
Status

Active

Version

3.0

Component

Code

Created by

πŸ‡―πŸ‡΅Japan hktang

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @hktang
  • First commit to issue fork.
  • Merge request !58Resolve #3517066 "Process dates hook" β†’ (Open) created by dcam
  • Pipeline finished with Success
    16 days ago
    Total: 150s
    #468542
  • πŸ‡ΊπŸ‡ΈUnited States dcam

    I verified that hook_fullcalendar_process_dates_alter() is non-functional. In the D7 versions this alter hook was invoked in the theme.inc file. It looks like that file was removed and split up during the D8 upgrade. During that process the hook invocation was lost and forgotten.

    I restored the invocation, but felt like I had to update its definition. This is a BC break, but BC is broken already and has been for years. I don't think it matters and shouldn't require a new major version. Anyway, the new hook definition works better with FullCalendar::prepareEvent() because I can just plug in existing variables. I think that the context information delivers the same information that it did in D7, just maybe not quite as conveniently, i.e. the field info would have to be extracted from the fields array.

    Anyway, I was able to successfully create a hook implementation with the code I've provided in the MR.

    I'm setting the priority to Major since this bug renders the hook unusable with no workaround.

  • Pipeline finished with Canceled
    16 days ago
    Total: 81s
    #468548
  • Pipeline finished with Failed
    16 days ago
    Total: 160s
    #468550
  • πŸ‡ΊπŸ‡ΈUnited States dcam

    dcam β†’ changed the visibility of the branch 3517066-process-dates-hook to hidden.

  • Merge request !59Applied changes from MR 58 β†’ (Open) created by dcam
  • Pipeline finished with Failed
    16 days ago
    Total: 163s
    #468652
  • πŸ‡ΊπŸ‡ΈUnited States dcam

    I hid MR 58 because there was something wrong with it. I think it was caused by me opening the MR while the issue version was set to 3.0.2. MR 59 was properly created from the 3.1.x branch.

Production build 0.71.5 2024