Exemplo n.º 1
0
 /**
  * Initialize the handler
  *
  * @param AbstractLinkBrowserController $linkBrowser
  * @param string $identifier
  * @param array $configuration Page TSconfig
  *
  * @return void
  */
 public function initialize(AbstractLinkBrowserController $linkBrowser, $identifier, array $configuration)
 {
     $this->linkBrowser = $linkBrowser;
     $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class);
     $this->view = GeneralUtility::makeInstance(\TYPO3\CMS\Fluid\View\StandaloneView::class);
     $this->view->getRequest()->setControllerExtensionName('recordlist');
     $this->view->setTemplateRootPaths([GeneralUtility::getFileAbsFileName('EXT:recordlist/Resources/Private/Templates/LinkBrowser')]);
     $this->view->setPartialRootPaths([GeneralUtility::getFileAbsFileName('EXT:recordlist/Resources/Private/Partials/LinkBrowser')]);
     $this->view->setLayoutRootPaths([GeneralUtility::getFileAbsFileName('EXT:recordlist/Resources/Private/Layouts/LinkBrowser')]);
 }
Exemplo n.º 2
0
 /**
  * Set template
  *
  * @param array $conf With possibly set file resource
  * @return void
  * @throws \InvalidArgumentException
  */
 protected function setTemplate(array $conf)
 {
     // Fetch the Fluid template by templateName
     if (!empty($conf['templateName']) && !empty($conf['templateRootPaths.']) && is_array($conf['templateRootPaths.'])) {
         $templateRootPaths = array();
         foreach ($conf['templateRootPaths.'] as $key => $path) {
             if (strpos($key, '.') === false) {
                 $templateRootPaths[$key] = isset($conf['templateRootPaths.'][$key . '.']) ? GeneralUtility::getFileAbsFileName($this->cObj->stdWrap($conf['templateRootPaths.'][$key], $conf['templateRootPaths.'][$key . '.'])) : GeneralUtility::getFileAbsFileName($path);
             }
         }
         $this->view->setTemplateRootPaths($templateRootPaths);
         $templateName = isset($conf['templateName.']) ? $this->cObj->stdWrap($conf['templateName'], $conf['templateName.']) : $conf['templateName'];
         $this->view->setTemplate($templateName);
         // Fetch the Fluid template by template cObject
     } elseif (!empty($conf['template']) && !empty($conf['template.'])) {
         $templateSource = $this->cObj->cObjGetSingle($conf['template'], $conf['template.']);
         $this->view->setTemplateSource($templateSource);
         // Fetch the Fluid template by file stdWrap
     } else {
         $file = isset($conf['file.']) ? $this->cObj->stdWrap($conf['file'], $conf['file.']) : $conf['file'];
         /** @var $templateService \TYPO3\CMS\Core\TypoScript\TemplateService */
         $templateService = $GLOBALS['TSFE']->tmpl;
         $templatePathAndFilename = $templateService->getFileName($file);
         $this->view->setTemplatePathAndFilename(PATH_site . $templatePathAndFilename);
     }
 }
Exemplo n.º 3
0
 /**
  * @test
  */
 public function setTemplateWalksStringKeysInReversedOrder()
 {
     $this->view->setTemplateRootPaths(array('default' => 'some/Default/Directory', 'specific' => 'specific/Templates', 'verySpecific' => 'evenMore/Specific/Templates'));
     $this->mockRequest->expects($this->any())->method('getFormat')->will($this->returnValue('html'));
     $this->view->expects($this->at(0))->method('testFileExistence')->with(PATH_site . 'evenMore/Specific/Templates/Template.html')->will($this->returnValue(false));
     $this->view->expects($this->at(1))->method('testFileExistence')->with(PATH_site . 'evenMore/Specific/Templates/Template')->will($this->returnValue(false));
     $this->view->expects($this->at(2))->method('testFileExistence')->with(PATH_site . 'specific/Templates/Template.html')->will($this->returnValue(false));
     $this->view->expects($this->at(3))->method('testFileExistence')->with(PATH_site . 'specific/Templates/Template')->will($this->returnValue(false));
     $this->view->expects($this->at(4))->method('testFileExistence')->with(PATH_site . 'some/Default/Directory/Template.html')->will($this->returnValue(false));
     $this->view->expects($this->at(5))->method('testFileExistence')->with(PATH_site . 'some/Default/Directory/Template')->will($this->returnValue(true));
     $this->view->setTemplate('Template');
     $this->assertEquals(PATH_site . 'some/Default/Directory/Template', $this->view->getTemplatePathAndFilename());
 }
Exemplo n.º 4
0
 /**
  * Set template
  *
  * @param array $conf With possibly set file resource
  * @return void
  * @throws \InvalidArgumentException
  */
 protected function setTemplate(array $conf)
 {
     // Fetch the Fluid template by templateName
     if ((!empty($conf['templateName']) || !empty($conf['templateName.'])) && !empty($conf['templateRootPaths.']) && is_array($conf['templateRootPaths.'])) {
         $templateRootPaths = $this->applyStandardWrapToFluidPaths($conf['templateRootPaths.']);
         $this->view->setTemplateRootPaths($templateRootPaths);
         $templateName = isset($conf['templateName.']) ? $this->cObj->stdWrap(isset($conf['templateName']) ? $conf['templateName'] : '', $conf['templateName.']) : $conf['templateName'];
         $this->view->setTemplate($templateName);
         // Fetch the Fluid template by template cObject
     } elseif (!empty($conf['template']) && !empty($conf['template.'])) {
         $templateSource = $this->cObj->cObjGetSingle($conf['template'], $conf['template.']);
         $this->view->setTemplateSource($templateSource);
         // Fetch the Fluid template by file stdWrap
     } else {
         $file = isset($conf['file.']) ? $this->cObj->stdWrap($conf['file'], $conf['file.']) : $conf['file'];
         /** @var $templateService \TYPO3\CMS\Core\TypoScript\TemplateService */
         $templateService = $GLOBALS['TSFE']->tmpl;
         $templatePathAndFilename = $templateService->getFileName($file);
         $this->view->setTemplatePathAndFilename(PATH_site . $templatePathAndFilename);
     }
 }
Exemplo n.º 5
0
 /**
  * Class constructor
  * Sets up view and property objects
  *
  * @throws InvalidTemplateResourceException In case a template is invalid
  */
 public function __construct()
 {
     $this->view = GeneralUtility::makeInstance(StandaloneView::class);
     $this->view->setPartialRootPaths($this->partialRootPaths);
     $this->view->setTemplateRootPaths($this->templateRootPaths);
     $this->view->setLayoutRootPaths($this->layoutRootPaths);
     $this->view->setTemplate($this->templateFile);
     $this->pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
     $this->docHeaderComponent = GeneralUtility::makeInstance(DocHeaderComponent::class);
     $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class);
 }
Exemplo n.º 6
0
 /**
  * Constructor
  */
 public function __construct()
 {
     $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class);
     $this->moduleTemplate = GeneralUtility::makeInstance(ModuleTemplate::class);
     $this->presetRepository = GeneralUtility::makeInstance(PresetRepository::class);
     $templatePath = ExtensionManagementUtility::extPath('impexp') . 'Resources/Private/';
     /* @var $view StandaloneView */
     $this->standaloneView = GeneralUtility::makeInstance(StandaloneView::class);
     $this->standaloneView->setTemplateRootPaths([$templatePath . 'Templates/ImportExport/']);
     $this->standaloneView->setLayoutRootPaths([$templatePath . 'Layouts/']);
     $this->standaloneView->setPartialRootPaths([$templatePath . 'Partials/']);
     $this->standaloneView->getRequest()->setControllerExtensionName('impexp');
 }
Exemplo n.º 7
0
 /**
  * Set the view
  *
  * @param array $templateRootPaths The template root paths
  */
 protected function setView($templateRootPaths)
 {
     $this->view = GeneralUtility::makeInstance(StandaloneView::class);
     $this->view->setTemplateRootPaths($templateRootPaths);
 }