|
11 | 11 | namespace Joomla\Plugin\Behaviour\Compat\Extension; |
12 | 12 |
|
13 | 13 | use Joomla\CMS\Event\Application\AfterInitialiseDocumentEvent; |
| 14 | +use Joomla\CMS\Event\Application\AfterRouteEvent; |
| 15 | +use Joomla\CMS\Factory; |
14 | 16 | use Joomla\CMS\Plugin\CMSPlugin; |
15 | 17 | use Joomla\Event\DispatcherInterface; |
16 | 18 | use Joomla\Event\Priority; |
17 | 19 | use Joomla\Event\SubscriberInterface; |
18 | | -use Joomla\Plugin\Behaviour\Compat\HTMLHelper\Bootstrap; |
19 | 20 |
|
20 | 21 | // phpcs:disable PSR1.Files.SideEffects |
21 | 22 | \defined('_JEXEC') or die; |
@@ -44,6 +45,7 @@ public static function getSubscribedEvents(): array |
44 | 45 | */ |
45 | 46 | return [ |
46 | 47 | 'onAfterInitialiseDocument' => ['onAfterInitialiseDocument', Priority::HIGH], |
| 48 | + 'onAfterRoute' => ['onAfterRoute', Priority::HIGH], |
47 | 49 | ]; |
48 | 50 | } |
49 | 51 |
|
@@ -84,24 +86,36 @@ public function __construct(DispatcherInterface $dispatcher, array $config = []) |
84 | 86 | } |
85 | 87 |
|
86 | 88 | /** |
87 | | - * We run as early as possible, this should be the first event |
| 89 | + * The after Route logic |
88 | 90 | * |
89 | | - * @param AfterInitialiseDocumentEvent $event |
| 91 | + * @param AfterRouteEvent $event |
90 | 92 | * @return void |
91 | 93 | * |
92 | | - * @since 5.0.0 |
| 94 | + * @since __DEPLOY_VERSION__ |
93 | 95 | */ |
94 | | - public function onAfterInitialiseDocument(AfterInitialiseDocumentEvent $event) |
| 96 | + public function onAfterRoute($event) |
95 | 97 | { |
96 | 98 | /** |
97 | 99 | * Load the deprecated HTMLHelper classes/functions |
98 | 100 | * likely be removed in Joomla 7.0 |
99 | 101 | */ |
100 | 102 | if ($this->params->get('html_helpers', '1')) { |
101 | 103 | // Restore HTMLHelper::Bootstrap('framework') |
102 | | - new Bootstrap(); |
| 104 | + Factory::getContainer()->get(\Joomla\CMS\HTML\Registry::class) |
| 105 | + ->register('bootstrap', \Joomla\Plugin\Behaviour\Compat\HTMLHelper\Bootstrap::class, true); |
103 | 106 | } |
| 107 | + } |
104 | 108 |
|
| 109 | + /** |
| 110 | + * We run as early as possible, this should be the first event |
| 111 | + * |
| 112 | + * @param AfterInitialiseDocumentEvent $event |
| 113 | + * @return void |
| 114 | + * |
| 115 | + * @since 5.0.0 |
| 116 | + */ |
| 117 | + public function onAfterInitialiseDocument(AfterInitialiseDocumentEvent $event) |
| 118 | + { |
105 | 119 | /** |
106 | 120 | * Load the es5 assets stubs, they are needed if an extension |
107 | 121 | * directly uses a core es5 asset which has no function in Joomla 5+ |
|
0 commit comments