Important: The events of one plugin rendering share their context 

Description 

An academic plugin that dispatched several events while it rendered handed each of them a plugin action context of its own. The plugin view event built one from the request and the settings, and the partner and project lists built another one for their demand and list events, as the persons plugins did for their query and page title events.

Every action now builds its context once, before its first event and after its settings are settled, and hands the same object to every event it dispatches:

  • \FGTCLB\AcademicBase\Event\ModifyPluginViewEvent ,
  • the demand and list events of academic_partners, academic_programs and academic_projects,
  • the query and page title events of academic_persons,
  • and the write event of academic_persons_edit.

Impact 

A listener of several events of one rendering receives one context, with the settings the action uses, and can keep what it collects for one rendering keyed by that object.

The persons plugins hand the view event the persons context they already handed their query events. It implements \FGTCLB\AcademicBase\Domain\Model\Dto\PluginControllerActionContextInterface , which the event declares, so a listener typed against that interface notices nothing. A listener that checked for the class \FGTCLB\AcademicBase\Domain\Model\Dto\PluginControllerActionContext checks for the interface instead.

The internal helper the controllers dispatch the view event with takes the context instead of the request and the settings. It is marked @internal and is not meant to be called by a project.