Don't assume 'field_branch_hours' is populated

Created on 20 September 2023, about 1 year ago

Problem/Motivation

I'm seeing a fatal caused by calling \Drupal\y_branch\BranchHoursHelper::getBranchHours() on a node without field_branch_hours set. It looks like the field is optional, so I reckon this should be supported. (Alternatively I guess the field could be made mandatory and we could throw if it's empty?)

Steps to reproduce

Pass a node without the field set to the method.

Proposed resolution

Don't just check if the field exists, check it's populated.

Remaining tasks

Thanks!

πŸ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom AndyF

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

Comments & Activities

Production build 0.71.5 2024