I've discovered an issue where the Office Hours module is removing unrelated warning messages, specifically from the Content Lock module, when using the office_hours widget.
The culprit appears to be this line in OfficeHoursComplexWeekWidget.php:
\Drupal::messenger()->deleteByType(static::MESSAGE_TYPE);
This clears all warning messages (MessengerInterface::TYPE_WARNING) at the end of formElement(), even those not generated by Office Hours itself.
I commented out this line:
// \Drupal::messenger()->deleteByType(static::MESSAGE_TYPE);
With this change, messages from content_lock displays correctly again.
Office Hours should track only the messages it adds, for example by storing them in a static class property or a dedicated service. It could then provide a helper method such as clearOwnMessages()
to remove only those specific messages from the messenger service. This would avoid relying on deleteByType()
, which clears all messages of a given type and should be used only when absolutely necessary.
Thanks for maintaining this module.
Active
1.0
Code - widget
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.