For developers
The content elements of this extension dispatch PSR-14 events. They are the
supported way to change what the partner list and the partner map query and
what the four content elements render, and they replace the only alternative
there used to be: subclassing
Partner and re-registering the
plugin. The controller is final since version 3.0, see
Breaking: The partner controller is final.
Which classes of this extension are public API, and what that promises, is stated for all academic extensions on the extension points page of academic_base.
Events
| Event | Dispatched | What a listener can change | Owner |
|---|---|---|---|
| ModifyPartnerDemandEvent | by the Partner List and the Partner Map, after the demand is built from the content element and the request, before the partners are queried | change or replace the demand | this extension |
| ModifyPartnerListEvent | by the same two, after the query and before the view variables are assigned | replace the partners and the categories of the filter, assign further view variables | this extension |
| ModifyPluginViewEvent | by all four content elements, after they assigned their view variables | assign further view variables | academic_base |
The two events of this extension carry
\FGTCLB\
through
get: the request, the site and
its language, the content object of the element, the settings of the content
element and the plugin name.
The plugin name is the name the plugin was registered with,
List
for
the list and
Map
for the map, not the content element type. It is how
one listener serves both and acts on one:
if ($event->getPluginControllerActionContext()->getPluginName() !== 'Map') {
return;
}
Neither event of this extension fires for a submission of the filter and sorting form: the plugin answers the POST with a redirect to a URL carrying the selection before the demand event, and both events fire on the request that follows, with the selection in the query string (or the route), not in the parsed body. See Feature: Partner filter selections have a URL.
Nothing changes in an installation that has no listener: without one, the content elements query and render exactly what they did before.