Skip to content

Commit

Permalink
Fix tree controller
Browse files Browse the repository at this point in the history
  • Loading branch information
zonky2 committed Jan 6, 2025
1 parent b5d450f commit ae74641
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/Controller/BackendTreeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,6 @@ private function initializeAndExtractRequest(): Request
* @var Controller $controller
*/
$controller = $framework->getAdapter(Controller::class);
/** @psalm-suppress DeprecatedMethod */
$controller->setStaticUrls();
$controller->loadLanguageFile('default');

$requestStack = $container->get('request_stack');
Expand Down Expand Up @@ -171,13 +169,16 @@ private function runBackendTree(Request $request)
{
[$value, $treeSelector] = $this->getTemplateData($request);

$container = $this->container;
assert($container instanceof SymfonyContainerInterface);

$template = new ContaoBackendViewTemplate('be_main');
$template
->set('isPopup', true)
->set('main', $treeSelector->generatePopup())
->set('theme', Backend::getTheme())
->set('base', Environment::get('base'))
->set('language', $GLOBALS['TL_LANGUAGE'])
->set('language', $container->get('request_stack')->getCurrentRequest()->getLocale())
->set(
'title',
StringUtil::specialchars(
Expand All @@ -188,7 +189,7 @@ private function runBackendTree(Request $request)
)
)
)
->set('charset', $GLOBALS['TL_CONFIG']['characterSet'])
->set('charset', 'utf-8')
->set('addSearch', $treeSelector->searchField)
->set('search', $this->getTranslator()->trans('search', [], 'dc-general'))
->set('action', StringUtil::ampersand($request->getUri()))
Expand Down Expand Up @@ -357,7 +358,10 @@ private function getTemplateData(Request $request, bool $valueFromRequest = fals
$picker = $pickerBuilder->createFromData($getPicker);
assert($picker instanceof PickerInterface);
$treeSelector = $this->prepareTreeSelector($picker);
$session = $container->get('session');
//$session = $container->get('session');
$requestStack = $container->get('request_stack');
assert($requestStack instanceof RequestStack);
$session = $requestStack->getSession();
assert($session instanceof SessionInterface);
$sessionBag = $session->getBag('contao_backend');
assert($sessionBag instanceof AttributeBagInterface);
Expand Down Expand Up @@ -404,7 +408,10 @@ private function prepareTreeSelector(PickerInterface $picker)
$container = $this->container;
assert($container instanceof SymfonyContainerInterface);

$session = $container->get('session');
//$session = $container->get('session');
$requestStack = $container->get('request_stack');
assert($requestStack instanceof RequestStack);
$session = $requestStack->getSession();
assert($session instanceof SessionInterface);

$sessionBag = $session->getBag('contao_backend');
Expand Down

0 comments on commit ae74641

Please sign in to comment.