Ejemplo n.º 1
0
 /**
  * @return string
  */
 public function indexAction()
 {
     $this->view->assign('grid', $this->grid);
     $this->view->assign('row', $this->row);
     $paths = $this->configurationService->getViewConfigurationForExtensionName('flux');
     $templateRootPath = TRUE === isset($paths['templateRootPath']) ? $paths['templateRootPath'] : NULL;
     $templatePathAndFilename = ResolveUtility::resolveWidgetTemplateFileBasedOnTemplateRootPathAndEnvironment($templateRootPath);
     $this->view->setTemplatePathAndFilename($templatePathAndFilename);
 }
 /**
  * @param string $controllerName
  * @return array
  */
 protected function createDummyRequestAndResponseForFluxController($controllerName = 'Content')
 {
     /** @var Request $request */
     $request = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Request');
     $request->setControllerExtensionName('Flux');
     $request->setControllerActionName($this->defaultAction);
     $request->setControllerName($controllerName);
     $request->setControllerObjectName(ResolveUtility::resolveFluxControllerClassNameByExtensionKeyAndAction($this->extensionName, $this->defaultAction, $controllerName));
     $request->setFormat('html');
     /** @var Response $response */
     $response = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Response');
     return array($request, $response);
 }
Ejemplo n.º 3
0
 /**
  * @param array $row
  * @return string
  */
 public function getTemplatePathAndFilename(array $row)
 {
     if (FALSE === empty($this->templatePathAndFilename)) {
         $templatePathAndFilename = GeneralUtility::getFileAbsFileName($this->templatePathAndFilename);
         if (TRUE === file_exists($templatePathAndFilename)) {
             return $templatePathAndFilename;
         }
     } else {
         $templatePathAndFilename = $row['tx_fed_fcefile'];
         if (FALSE === strpos($templatePathAndFilename, ':')) {
             return NULL;
         }
     }
     list(, $filename) = explode(':', $templatePathAndFilename);
     list($controllerAction, $format) = explode('.', $filename);
     $paths = $this->getTemplatePaths($row);
     $templatePathAndFilename = ResolveUtility::resolveTemplatePathAndFilenameByPathAndControllerNameAndActionAndFormat($paths, 'Content', $controllerAction, $format);
     return $templatePathAndFilename;
 }
Ejemplo n.º 4
0
 /**
  * @test
  */
 public function resolvePossibleOverlayTemplateFileDetectsOverlayFile()
 {
     $overlays = array(array('templateRootPath' => 'EXT:flux/Resources/Private/Templates/SomeFolder/'), array('templateRootPath' => 'EXT:flux/Resources/Private/Templates/'), array('templateRootPath' => 'EXT:flux/Resources/Private/Templates/ViewHelpers/Widget/'));
     $controller = 'Grid';
     $action = 'index';
     $format = 'html';
     $result = ResolveUtility::resolvePossibleOverlayTemplateFile($overlays, $controller, $action, $format);
     $expected = GeneralUtility::getFileAbsFileName('EXT:flux/Resources/Private/Templates/ViewHelpers/Widget/Grid/Index.html');
     $this->assertEquals($expected, $result);
 }
 /**
  * @param string $extensionName
  * @param string $controllerName
  * @param string $actionName
  * @return boolean
  */
 protected function hasSubControllerActionOnForeignController($extensionName, $controllerName, $actionName)
 {
     $potentialControllerClassName = ResolveUtility::resolveFluxControllerClassNameByExtensionKeyAndAction($extensionName, $actionName, $controllerName);
     $isForeign = $extensionName !== $this->extensionName;
     $isValidController = class_exists($potentialControllerClassName);
     return TRUE === $isForeign && TRUE === $isValidController;
 }
Ejemplo n.º 6
0
 /**
  * @param string $actionName
  * @return string
  */
 public function getTemplatePathAndFilename($actionName = NULL)
 {
     if (NULL !== $this->templatePathAndFilename) {
         return $this->templatePathAndFilename;
     }
     if (TRUE === empty($actionName)) {
         $actionName = $this->controllerContext->getRequest()->getControllerActionName();
     }
     $actionName = ResolveUtility::convertAllPathSegmentsToUpperCamelCase($actionName);
     $paths = $this->expandGenericPathPattern($this->templatePathAndFilenamePattern, FALSE, FALSE);
     foreach ($paths as &$templatePathAndFilename) {
         $templatePathAndFilename = str_replace('@action', $actionName, $templatePathAndFilename);
         if (TRUE === file_exists($templatePathAndFilename)) {
             return $templatePathAndFilename;
         }
     }
     return parent::getTemplatePathAndFilename($actionName);
 }
Ejemplo n.º 7
0
 /**
  * @param array $row
  * @return string
  */
 public function getTemplatePathAndFilename(array $row)
 {
     $action = $this->getControllerActionReferenceFromRecord($row);
     $paths = $this->getTemplatePaths($row);
     if (FALSE === empty($action)) {
         list(, $action) = explode('->', $action);
         $templatePathAndFilename = ResolveUtility::resolveTemplatePathAndFilenameByPathAndControllerNameAndActionAndFormat($paths, 'Page', $action);
     }
     $templatePathAndFilename = GeneralUtility::getFileAbsFileName($templatePathAndFilename);
     return $templatePathAndFilename;
 }
Ejemplo n.º 8
0
 /**
  * @return string
  */
 public function indexAction()
 {
     $workspaceVersionOfRecord = $this->workspacesAwareRecordService->getSingle('tt_content', '*', $this->row['uid']);
     $this->view->assign('grid', $this->grid);
     $this->view->assign('row', $workspaceVersionOfRecord);
     $this->view->assign('colPosFluxContent', ContentService::COLPOS_FLUXCONTENT);
     $paths = $this->configurationService->getViewConfigurationForExtensionName('flux');
     $templateRootPath = TRUE === isset($paths['templateRootPath']) ? $paths['templateRootPath'] : NULL;
     $templatePathAndFilename = ResolveUtility::resolveWidgetTemplateFileBasedOnTemplateRootPathAndEnvironment($templateRootPath);
     $this->view->setTemplatePathAndFilename($templatePathAndFilename);
 }
 /**
  * @test
  */
 public function canDetectCurrentPageRecord()
 {
     $result = ResolveUtility::resolveCurrentPageRecord();
     $this->assertNull($result);
     $expected = array('uid' => 99999999);
     $GLOBALS['TSFE'] = new TypoScriptFrontendController($GLOBALS['TYPO3_CONF_VARS'], 1, 0);
     $GLOBALS['TSFE']->page = $expected;
     $result = ResolveUtility::resolveCurrentPageRecord();
     $this->assertSame($result, $expected);
 }
 /**
  * @test
  */
 public function canDetectPresenceOfRegisteredCustomControllerForContent()
 {
     $this->performDummyRegistration();
     $hasController = ResolveUtility::resolveFluxControllerClassNameByExtensionKeyAndAction('FluidTYPO3.Flux', 'render', 'Content');
     $this->assertTrue(class_exists($hasController));
 }