Do not add 'calendar/calendar.theme' to every page.

Created on 18 April 2023, over 1 year ago

Problem/Motivation

When inspecting code, the 🐛 Remove 'min-height: auto' . It is not supported by Firefox 22+ Fixed pops up, even if no calendar is displayed on the page.
(Not sure if I am running 8.x-2.x or 8.x-1.x)

Steps to reproduce

- Install Calendar module.
- Open a page with no Calendar (e.g., node edit)
- right click, 'open html source' and see that 'calendar.theme' is included in the page.

Proposed resolution

Move the following from the page to the Calendar element.

/**
 * Implements hook_page_attachments().
 */
function calendar_page_attachments(array &$page) {
  $page['#attached']['library'][] = 'calendar/calendar.theme';
}

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇳🇱Netherlands johnv

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

Comments & Activities

  • Issue created by @johnv
  • First commit to issue fork.
  • Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7
    last update over 1 year ago
    Waiting for branch to pass
  • @sakthi_dev opened merge request.
  • Status changed to Needs review over 1 year ago
  • 🇮🇳India sakthi_dev

    Please review.

  • Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7
    last update over 1 year ago
    Waiting for branch to pass
  • 🇳🇱Netherlands johnv

    It seems sufficient to just add the library to the CalendarHeader.php render array .
    That always exists on a calendar page.
    See attached file.

  • 🇨🇦Canada joelpittet Vancouver

    @johnv I was thinking the same thing but that would mean it would only be added when the view has the CalendarHeader area in there... The MR looks better at this point but maybe there is somewhere a little less global we could add it?

Production build 0.71.5 2024