Breaking: The persons plugin action context extends the one of academic_base
See also
Upgrading from 2.4 to 3.0 is the order in which the 3.0 changes have to be applied.
Description
\FGTCLB\
now extends
\FGTCLB\
and declares nothing of its own. Up to 2.4 it was a copy of that interface
without
get, so the two were different types: a
listener written for an event of academic_jobs,
academic_partners or academic_projects could not take
the context of a persons event, and the context of a persons event could not
say which content element it was rendered for.
The context class of this extension,
\FGTCLB\,
gains
get. It returns the content object of the
request the plugin renders in, and
null
when the request carries none,
exactly as the academic_base context does.
The events keep the types they declare, so a listener typed against the persons interface is called as before. Of the persons events that declared it, only the page title placeholder event is left: the list, detail, selected profiles and selected contracts events are removed in 3.0, see Breaking: The list, detail and selection events of the plugins are gone.
Impact
A class of a project that implements the persons interface itself is a fatal
error until it adds
get. PHP checks that
when the class is loaded, so the installation breaks on the first request that
uses the class rather than silently.
A listener of a persons event may now type the context it receives against the academic_base interface, and may read the content element from it.
Affected Installations
Installations with a class of their own implementing
\FGTCLB\.
None of the extensions ships one apart from the context class above.
Migration
Add the method to the implementing class:
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
public function getContentObjectRenderer(): ?ContentObjectRenderer
{
$contentObject = $this->request->getAttribute('currentContentObject');
return $contentObject instanceof ContentObjectRenderer ? $contentObject : null;
}
Keep implementing the persons interface for as long as the object is handed to the page title placeholder event: it declares the persons interface throughout 3.x, and an object that implements only the academic_base interface is a type error there. Switch to the academic_base interface with 4.0, see Deprecation: The plugin action context of academic_persons.