|
25 | 25 | use Joomla\CMS\Language\Text; |
26 | 26 | use Joomla\CMS\Log\Log; |
27 | 27 | use Joomla\CMS\Menu\AbstractMenu; |
| 28 | +use Joomla\CMS\Menu\MenuFactoryInterface; |
28 | 29 | use Joomla\CMS\Pathway\Pathway; |
29 | 30 | use Joomla\CMS\Plugin\PluginHelper; |
30 | 31 | use Joomla\CMS\Profiler\Profiler; |
@@ -128,6 +129,15 @@ abstract class CMSApplication extends WebApplication implements ContainerAwareIn |
128 | 129 | */ |
129 | 130 | protected $authenticationPluginType = 'authentication'; |
130 | 131 |
|
| 132 | + /** |
| 133 | + * The menu factory |
| 134 | + * |
| 135 | + * @var MenuFactoryInterface |
| 136 | + * |
| 137 | + * @since __DEPLOY_VERSION__ |
| 138 | + */ |
| 139 | + private $menuFactory; |
| 140 | + |
131 | 141 | /** |
132 | 142 | * Class constructor. |
133 | 143 | * |
@@ -515,7 +525,12 @@ public function getMenu($name = null, $options = array()) |
515 | 525 | $options['app'] = $this; |
516 | 526 | } |
517 | 527 |
|
518 | | - return AbstractMenu::getInstance($name, $options); |
| 528 | + if ($this->menuFactory === null) |
| 529 | + { |
| 530 | + $this->menuFactory = $this->getContainer()->get(MenuFactoryInterface::class); |
| 531 | + } |
| 532 | + |
| 533 | + return $this->menuFactory->createMenu($name, $options); |
519 | 534 | } |
520 | 535 |
|
521 | 536 | /** |
@@ -1450,4 +1465,18 @@ private function setupLogging(): void |
1450 | 1465 | Log::addLogger(['text_file' => 'custom-logging.php'], $priority, $categories, $mode); |
1451 | 1466 | } |
1452 | 1467 | } |
| 1468 | + |
| 1469 | + /** |
| 1470 | + * Sets the internal menu factory. |
| 1471 | + * |
| 1472 | + * @param MenuFactoryInterface $menuFactory The menu factory |
| 1473 | + * |
| 1474 | + * @return void |
| 1475 | + * |
| 1476 | + * @since __DEPLOY_VERSION__ |
| 1477 | + */ |
| 1478 | + public function setMenuFactory(MenuFactoryInterface $menuFactory): void |
| 1479 | + { |
| 1480 | + $this->menuFactory = $menuFactory; |
| 1481 | + } |
1453 | 1482 | } |
0 commit comments