예제 #1
0
 /**
  * This removes controller and/or action arguments from given controllerArguments
  * if they are equal to the default controller/action of the target plugin.
  * Note: This is only active in FE mode and if feature "skipDefaultArguments" is enabled
  *
  * @see \TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::isFeatureEnabled()
  * @param array $controllerArguments the current controller arguments to be modified
  * @param string $extensionName target extension name
  * @param string $pluginName target plugin name
  * @return array
  */
 protected function removeDefaultControllerAndAction(array $controllerArguments, $extensionName, $pluginName)
 {
     $defaultControllerName = $this->extensionService->getDefaultControllerNameByPlugin($extensionName, $pluginName);
     if (isset($controllerArguments['action'])) {
         $defaultActionName = $this->extensionService->getDefaultActionNameByPluginAndController($extensionName, $pluginName, $controllerArguments['controller']);
         if ($controllerArguments['action'] === $defaultActionName) {
             unset($controllerArguments['action']);
         }
     }
     if ($controllerArguments['controller'] === $defaultControllerName) {
         unset($controllerArguments['controller']);
     }
     return $controllerArguments;
 }
예제 #2
0
 /**
  * @test
  */
 public function getDefaultControllerNameByPluginReturnsFirstControllerNameOfGivenPlugin()
 {
     $expectedResult = 'ControllerName';
     $actualResult = $this->extensionService->getDefaultControllerNameByPlugin('ExtensionName', 'SomePlugin');
     $this->assertEquals($expectedResult, $actualResult);
 }