Inline static variable can cause day to display as 'and' in a View

Created on 24 April 2024, 7 months ago
Updated 17 May 2024, 6 months ago

Problem/Motivation

In certain situations using a Drupal View the Office Hour day incorrectly displays as 'and'.

When a View is displaying if the previous Node's last office is on the same day as the current Node's first office hour then the day displays as 'and' due to incorrect day_delta.

https://git.drupalcode.org/project/office_hours/-/blob/8.x-1.x/src/Plugi...

Steps to reproduce

  1. create a node (node 1) with an office hour on a specific day
  2. create another node (node 2) with an office hour on the same day
  3. create a view that display office hours and displays (node 1) before (node 2)

Proposed resolution

Pass in node_id to know when to reset day_delta.
I didn't know you could inline static variables in PHP and I question every using this feature.
While I think manage state between OfficeHourItems should be done at a higher level it seems like too much work at this time.

Remaining tasks

Test and review

User interface changes

None

API changes

None

Data model changes

None

🐛 Bug report
Status

Fixed

Version

1.17

Component

Code - formatter

Created by

🇺🇸United States ian.ssu

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024