/**
  * @param BeforeGroupingChainWidgetEvent $event
  */
 public function isAllowedButton(BeforeGroupingChainWidgetEvent $event)
 {
     if ($this->isFrontendRoute()) {
         // Clear allowed widgets
         $event->setWidgets([]);
         $event->stopPropagation();
     } else {
         $this->filter->isAllowedButton($event);
     }
 }
Пример #2
0
 /**
  * @dataProvider isAllowedButtonProvider
  * @param int      $pageType
  * @param array    $widgets
  * @param object   $entity
  * @param int|null $configProviderSetting
  * @param array    $expected
  */
 public function testIsAllowedButton($pageType, $widgets, $entity, $configProviderSetting, $expected)
 {
     if ($configProviderSetting !== null) {
         $this->setConfigProviderEntitySupport($entity, $configProviderSetting);
     }
     $event = new BeforeGroupingChainWidgetEvent($pageType, $widgets, $entity);
     $this->filter->isAllowedButton($event);
     $this->assertEquals($expected, $event->getWidgets());
 }
Пример #3
0
 /**
  * @dataProvider   isAllowedButtonProvider
  *
  * @param int      $pageType
  * @param array    $widgets
  * @param object   $entity
  * @param int|null $configProviderSetting
  * @param array    $expected
  */
 public function testIsAllowedButton($pageType, $widgets, $entity, $configProviderSetting, $expected)
 {
     $this->configManager->expects($this->once())->method('hasConfig')->with(get_class($entity))->willReturn(true);
     if ($configProviderSetting !== null) {
         $config = new Config(new EntityConfigId('activity', get_class($entity)));
         $config->set(ActivityScope::SHOW_ON_PAGE, $configProviderSetting);
         $this->configManager->expects($this->once())->method('getEntityConfig')->with('activity', get_class($entity))->willReturn($config);
     }
     $event = new BeforeGroupingChainWidgetEvent($pageType, $widgets, $entity);
     $this->filter->isAllowedButton($event);
     $this->assertEquals($expected, $event->getWidgets());
 }