Feature: #99807 - Improve ModifyUrlForCanonicalTagEvent

See forge#99807


The \TYPO3\CMS\Seo\Event\ModifyUrlForCanonicalTagEvent, used by listeners to manipulate the URL of the canonical tag, has been improved. The event is is now being dispatched after the standard functionality, such as fetching the URL from the page properties, has been executed.

Additionally, the event is now even dispatched, in case the canonical tag generation is disabled via TypoScript disableCanonical or via page properties no_index. If disabled, the new \TYPO3\CMS\Seo\Exception\CanonicalGenerationDisabledException is being thrown in the CanonicalGenerator. The exception is caught and transferred to the event, allowing listeners to determine whether generation is disabled, using the new getCanonicalGenerationDisabledException() method, which either returns the exception with the corresponding reason or null.


By relocating and extending the ModifyUrlForCanonicalTagEvent, listeners are now able to fully manipulate the canonical tag generation, even if the generation is disabled and after the standard functionality has been executed.