Skip to content

Commit 9b0c23e

Browse files
committed
small refactoring
1 parent beadb31 commit 9b0c23e

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

Controller/MenuController.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,23 @@
22

33
namespace SmartCore\Module\Menu\Controller;
44

5+
use Symfony\Component\HttpFoundation\Request;
56
use Symfony\Component\HttpFoundation\Response;
67

78
class MenuController extends Controller
89
{
9-
public function indexAction()
10+
public function indexAction(Request $request)
1011
{
1112
$current_folder_path = $this->get('cms.context')->getCurrentFolderPath();
1213

1314
$cache_key = md5('smart_module.menu'.$current_folder_path.$this->node->getId());
1415

1516
if (false == $menu = $this->getCacheService()->get($cache_key)) {
1617
// Хак для Menu\RequestVoter
17-
$this->get('request')->attributes->set('__selected_inheritance', $this->selected_inheritance);
18-
$this->get('request')->attributes->set('__current_folder_path', $current_folder_path);
18+
$request->attributes->set('__selected_inheritance', $this->selected_inheritance);
19+
$request->attributes->set('__current_folder_path', $current_folder_path);
1920

20-
$menu = $this->renderView('MenuModule::menu.html.twig', [
21+
$menu = $this->get('twig')->render('MenuModule::menu.html.twig', [
2122
'css_class' => $this->css_class,
2223
'current_class' => $this->current_class,
2324
'depth' => $this->depth,
@@ -28,8 +29,8 @@ public function indexAction()
2829

2930
$this->getCacheService()->set($cache_key, $menu, ['smart_module.menu', 'folder', 'node_'.$this->node->getId()]);
3031

31-
$this->get('request')->attributes->remove('__selected_inheritance');
32-
$this->get('request')->attributes->remove('__current_folder_path');
32+
$request->attributes->remove('__selected_inheritance');
33+
$request->attributes->remove('__current_folder_path');
3334
}
3435

3536
$this->node->addFrontControl('edit')

0 commit comments

Comments
 (0)