Time object injected to \Drupal\content_moderation\Form\EntityModerationForm should be any implementor of \Drupal\Component\Datetime\TimeInterface. Rather than exactly \Drupal\Component\Datetime\Time.

This prevents overriding time service, especially in tests in order to simulate time.

CommentFileSizeAuthor
#4 3155022-4.patch1.34 KBcodersukanta

Comments

dpi created an issue. See original summary.

dpi’s picture

A fix would simply change the parameter type to TimeInterface, not Time.

codersukanta’s picture

Assigned: Unassigned » codersukanta
codersukanta’s picture

Assigned: codersukanta » Unassigned
Status: Active » Needs review
StatusFileSize
new1.34 KB

Replaced \Drupal\Component\Datetime\Time. with \Drupal\Component\Datetime\TimeInterface.

sam152’s picture

Status: Needs review » Reviewed & tested by the community

It would have been nice to remove it altogether with #2849279: Make the moderation control form an entity form so that it validates entities before save, however in the meantime, this is definitely wrong and is an easy fix to address.

larowlan’s picture

Status: Reviewed & tested by the community » Fixed

Confirmed there are no BC implications here if someone extended the class https://3v4l.org/pOokj

Not eligible for backport because of the nature of the patch.

Committed 664dee0 and pushed to 9.1.x. Thanks!

  • larowlan committed 664dee0 on 9.1.x
    Issue #3155022 by codersukanta: Loosen required implementation of time...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.