Problem/Motivation

Some of our form classes are injecting the Messenger service. This is not needed since the FormBase class uses the MessengerTrait so the messenger is already available.

Proposed resolution

  1. Remove the injection of the Messenger service from ::__construct() and ::create().
  2. Replace $this->messenger property accesses with $this->messenger() method calls.

Remaining tasks

Affected forms:

  • ContactForm
  • EventInstanceDeleteForm
  • EventInstanceForm
  • EventInstanceRevisionDeleteForm
  • EventInstanceRevisionRevertForm
  • EventInstanceTypeForm
  • EventSeriesDeleteForm
  • EventSeriesForm
  • EventSeriesRevisionDeleteForm
  • EventSeriesRevisionRevertForm
  • EventSeriesTypeDeleteForm
  • EventSeriesTypeForm
  • ExcludedDatesDeleteForm
  • ExcludedDatesForm
  • IncludedDatesDeleteForm
  • IncludedDatesForm
  • RegistrantDeleteForm
  • RegistrantForm
  • RegistrantResendForm
  • RegistrantTypeForm

API changes

Since this requires a change to the class constructor this affects B/C compatibility with code that might subclass our forms. Because of this, this can only be done in the 3.x branch.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

pfrenssen created an issue. See original summary.

pfrenssen’s picture

Issue summary: View changes
sayan_k_dutta’s picture

Assigned: Unassigned » sayan_k_dutta

Working on it.

sayan_k_dutta’s picture

Removed all the messenger services injection from the Form classes. Created MR!118. Please check it.

sayan_k_dutta’s picture

Status: Active » Needs review
pfrenssen’s picture

Assigned: sayan_k_dutta » Unassigned
Status: Needs review » Reviewed & tested by the community

Looking great, 300+ lines of unnecessary code are removed! Thanks a lot for working on this!

pfrenssen’s picture

Status: Reviewed & tested by the community » Fixed

No idea why the merging script decided to put my name first in the commit message :-/ I only changed one line while @sayan_k_dutta did ALL of the work.

Anyway thanks a lot for fixing this so quickly!

Status: Fixed » Closed (fixed)

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