Skip to content

Commit

Permalink
[TASK] Use factory for creating content object in LanguageMenuProcessor
Browse files Browse the repository at this point in the history
Resolves: #99728
Releases: main
Change-Id: Iac26c64e009df4b5a2d5c86bdaebe9a4989bb56e
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/77615
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: core-ci <typo3@b13.com>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Jochen <rothjochen@gmail.com>
Reviewed-by: Jochen <rothjochen@gmail.com>
Reviewed-by: Benni Mack <benni@typo3.org>
  • Loading branch information
o-ba authored and georgringer committed Jan 31, 2023
1 parent 41df9b9 commit ff01d6b
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
use TYPO3\CMS\Core\Site\Entity\Site;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Frontend\ContentObject\ContentDataProcessor;
use TYPO3\CMS\Frontend\ContentObject\ContentObjectFactory;
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
use TYPO3\CMS\Frontend\ContentObject\DataProcessorInterface;
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
Expand Down Expand Up @@ -248,12 +249,15 @@ class LanguageMenuProcessor implements DataProcessorInterface
*/
protected $contentDataProcessor;

protected ContentObjectFactory $contentObjectFactory;

/**
* Constructor
*/
public function __construct()
{
$this->contentDataProcessor = GeneralUtility::makeInstance(ContentDataProcessor::class);
$this->contentObjectFactory = GeneralUtility::makeInstance(ContentObjectFactory::class);
}

/**
Expand Down Expand Up @@ -398,7 +402,7 @@ public function process(ContentObjectRenderer $cObj, array $contentObjectConfigu
$this->validateAndBuildConfiguration();

// Process Configuration
$menuContentObject = $cObj->getContentObject('HMENU');
$menuContentObject = $this->contentObjectFactory->getContentObject('HMENU', $cObj->getRequest(), $cObj);
$renderedMenu = $menuContentObject?->render($this->menuConfig);
if (!$renderedMenu) {
return $processedData;
Expand Down

0 comments on commit ff01d6b

Please sign in to comment.