Example #1
0
 /**
  * @param $observer
  * @return $this
  */
 public function execute(EventObserver $observer)
 {
     $menu = $observer->getMenu();
     $tree = $menu->getTree();
     $fullAction = $this->request->getFullActionName();
     $selectedActions = ['gemtoo_blog_article_index', 'gemtoo_blog_article_view'];
     $articleNodeId = 'articles';
     $data = ['name' => __('Blog'), 'id' => $articleNodeId, 'url' => $this->articleUrl->getListUrl(), 'is_active' => in_array($fullAction, $selectedActions)];
     $articlesNode = new Node($data, 'id', $tree, $menu);
     $menu->addChild($articlesNode);
     return $this;
 }
Example #2
0
 public function testGetFullActionName()
 {
     $this->_model = $this->getModel();
     /* empty request */
     $this->assertEquals('__', $this->_model->getFullActionName());
     $this->_model->setRouteName('test')->setControllerName('controller')->setActionName('action');
     $this->assertEquals('test/controller/action', $this->_model->getFullActionName('/'));
 }
Example #3
0
 public function testGetFullActionName()
 {
     $this->_model = new Request($this->_routerListMock, $this->_infoProcessorMock);
     /* empty request */
     $this->assertEquals('__', $this->_model->getFullActionName());
     $this->_model->setRouteName('test')->setControllerName('controller')->setActionName('action');
     $this->assertEquals('test/controller/action', $this->_model->getFullActionName('/'));
 }
Example #4
0
 /**
  * Render current layout
  *
  * @param ResponseInterface $response
  * @return $this
  */
 public function renderResult(ResponseInterface $response)
 {
     \Magento\Framework\Profiler::start('LAYOUT');
     \Magento\Framework\Profiler::start('layout_render');
     $this->applyHttpHeaders($response);
     $this->render($response);
     $this->eventManager->dispatch('layout_render_before');
     $this->eventManager->dispatch('layout_render_before_' . $this->request->getFullActionName());
     \Magento\Framework\Profiler::stop('layout_render');
     \Magento\Framework\Profiler::stop('LAYOUT');
     return $this;
 }
Example #5
0
 /**
  * Generate layout blocks
  *
  * @return $this
  */
 protected function generateLayoutBlocks()
 {
     $this->beforeGenerateBlock();
     Profiler::start('LAYOUT');
     /* dispatch event for adding xml layout elements */
     $this->eventManager->dispatch('layout_generate_blocks_before', ['full_action_name' => $this->request->getFullActionName(), 'layout' => $this->layout]);
     Profiler::start('layout_generate_blocks');
     /* generate blocks from xml layout */
     $this->layout->generateElements();
     Profiler::stop('layout_generate_blocks');
     $this->eventManager->dispatch('layout_generate_blocks_after', ['full_action_name' => $this->request->getFullActionName(), 'layout' => $this->layout]);
     Profiler::stop('LAYOUT');
     $this->afterGenerateBlock();
     return $this;
 }