/** * @param FluidView $fluidView * @return void */ protected function initializeView(FluidView $fluidView) { if ($this['categoryId'] && $this['categoryId']) { $categoryId = (int) $this['categoryId']; $category = $this->getCategoryData($categoryId); $topics = $this->getTopics($category); $fluidView->assign('category', $category); $fluidView->assign('topics', $topics); } }
/** * @return void */ protected function initializeView(FluidView $fluidView) { $user = $this->getUserData($this['username']); $excludedProjects = Arrays::trimExplode(',', $this['excludedprojects']); $decodedProjects = $this->getProjectsData($user['id']); $projects = []; foreach ($decodedProjects['objects'] as $project) { if (!in_array($project['slug'], $excludedProjects)) { $projects[] = $project; } } $fluidView->assign('projects', $projects); }
/** * {@inheritdoc} * * @return string */ public function evaluate() { $actionRequest = $this->tsRuntime->getControllerContext()->getRequest(); if (!$actionRequest instanceof ActionRequest) { $actionRequest = null; } $fluidTemplate = new Helpers\FluidView($this, $actionRequest); $templatePath = $this->getTemplatePath(); if ($templatePath === null) { throw new \Exception(sprintf("\n\t\t\t\tNo template path set.\n\t\t\t\tMost likely you didn't configure `templatePath` in your TypoScript object correctly.\n\t\t\t\tFor example you could add and adapt the following line to your TypoScript:\n\t\t\t\t`prototype(%s) < prototype(TYPO3.TypoScript:Template) {\n\t\t\t\t\ttemplatePath = 'resource://Vendor.Package/Private/Templates/MyObject.html'\n\t\t\t\t}`\n\t\t\t", $templatePath, $this->typoScriptObjectName)); } $fluidTemplate->setTemplatePathAndFilename($templatePath); $partialRootPath = $this->getPartialRootPath(); if ($partialRootPath !== null) { $fluidTemplate->setPartialRootPath($partialRootPath); } $layoutRootPath = $this->getLayoutRootPath(); if ($layoutRootPath !== null) { $fluidTemplate->setLayoutRootPath($layoutRootPath); } // Template resources need to be evaluated from the templates package not the requests package. if (strpos($templatePath, 'resource://') === 0) { $templateResourcePathParts = parse_url($templatePath); $fluidTemplate->setResourcePackage($templateResourcePathParts['host']); } foreach ($this->properties as $key => $value) { if (in_array($key, $this->ignoreProperties)) { continue; } if (!is_array($value)) { // if a value is a SIMPLE TYPE, e.g. neither an Eel expression nor a TypoScript object, // we can just evaluate it (to handle processors) and then assign it to the template. $evaluatedValue = $this->tsValue($key); $fluidTemplate->assign($key, $evaluatedValue); } else { // It is an array; so we need to create a "proxy" for lazy evaluation, as it could be a // nested TypoScript object, Eel expression or simple value. $fluidTemplate->assign($key, new Helpers\TypoScriptPathProxy($this, $this->path . '/' . $key, $value)); } } $this->initializeView($fluidTemplate); $sectionName = $this->getSectionName(); if ($sectionName !== null) { return $fluidTemplate->renderSection($sectionName); } else { return $fluidTemplate->render(); } }
/** * @param FluidView $view * @return void */ public function initializeView(FluidView $view) { $assets = $this->tsValue('assets'); $processedAssets = array(); /** @var Asset $asset */ if (is_array($assets)) { foreach ($assets as $asset) { if ($asset->getResource() === null) { if ($asset instanceof Image) { $processedAssets[] = $this->imageRepository->findByIdentifier($asset->getIdentifier()); } elseif ($asset instanceof Asset) { $processedAssets[] = $this->assetRepository->findByIdentifier($asset->getIdentifier()); } } else { $processedAssets[] = $asset; } } } $view->assign('assets', $processedAssets); }
public function setUp() { parent::setUp(); $this->editableViewHelper = $this->getAccessibleMock('TYPO3\\Neos\\ViewHelpers\\ContentElement\\EditableViewHelper', array('renderChildren')); $this->mockPrivilegeManager = $this->getMockBuilder('TYPO3\\Flow\\Security\\Authorization\\PrivilegeManagerInterface')->getMock(); $this->inject($this->editableViewHelper, 'privilegeManager', $this->mockPrivilegeManager); $this->mockNodeAuthorizationService = $this->getMockBuilder(AuthorizationService::class)->getMock(); $this->inject($this->editableViewHelper, 'nodeAuthorizationService', $this->mockNodeAuthorizationService); $this->mockTemplateImplementation = $this->getMockBuilder('TYPO3\\TypoScript\\TypoScriptObjects\\TemplateImplementation')->disableOriginalConstructor()->getMock(); $this->mockTsRuntime = $this->getMockBuilder('TYPO3\\TypoScript\\Core\\Runtime')->disableOriginalConstructor()->getMock(); $this->mockContentContext = $this->getMockBuilder('TYPO3\\Neos\\Domain\\Service\\ContentContext')->disableOriginalConstructor()->getMock(); $this->mockNode = $this->getMockBuilder('TYPO3\\TYPO3CR\\Domain\\Model\\NodeInterface')->getMock(); $this->mockNode->expects($this->any())->method('getContext')->will($this->returnValue($this->mockContentContext)); $this->mockTsContext = array('node' => $this->mockNode); $this->mockTsRuntime->expects($this->any())->method('getCurrentContext')->will($this->returnValue($this->mockTsContext)); $this->mockTemplateImplementation->expects($this->any())->method('getTsRuntime')->will($this->returnValue($this->mockTsRuntime)); $this->mockView = $this->getAccessibleMock('TYPO3\\TypoScript\\TypoScriptObjects\\Helpers\\FluidView', array(), array(), '', FALSE); $this->mockView->expects($this->any())->method('getTypoScriptObject')->will($this->returnValue($this->mockTemplateImplementation)); $this->editableViewHelper->initializeArguments(); }
public function setUp() { parent::setUp(); $this->editableViewHelper = $this->getAccessibleMock(EditableViewHelper::class, array('renderChildren')); $this->mockPrivilegeManager = $this->getMockBuilder(PrivilegeManagerInterface::class)->getMock(); $this->inject($this->editableViewHelper, 'privilegeManager', $this->mockPrivilegeManager); $this->mockNodeAuthorizationService = $this->getMockBuilder(AuthorizationService::class)->getMock(); $this->inject($this->editableViewHelper, 'nodeAuthorizationService', $this->mockNodeAuthorizationService); $this->mockContentElementEditableService = $this->getMockBuilder(ContentElementEditableService::class)->getMock(); $this->inject($this->editableViewHelper, 'contentElementEditableService', $this->mockContentElementEditableService); $this->mockTemplateImplementation = $this->getMockBuilder(TemplateImplementation::class)->disableOriginalConstructor()->getMock(); $this->mockTsRuntime = $this->getMockBuilder(Runtime::class)->disableOriginalConstructor()->getMock(); $this->mockContentContext = $this->getMockBuilder(ContentContext::class)->disableOriginalConstructor()->getMock(); $this->mockNode = $this->getMockBuilder(NodeInterface::class)->getMock(); $this->mockNode->expects($this->any())->method('getContext')->will($this->returnValue($this->mockContentContext)); $this->mockNode->expects($this->any())->method('getNodeType')->will($this->returnValue(new NodeType('Acme.Test:Headline', [], []))); $this->mockTsContext = array('node' => $this->mockNode); $this->mockTsRuntime->expects($this->any())->method('getCurrentContext')->will($this->returnValue($this->mockTsContext)); $this->mockTemplateImplementation->expects($this->any())->method('getTsRuntime')->will($this->returnValue($this->mockTsRuntime)); $this->mockView = $this->getAccessibleMock(FluidView::class, array(), array(), '', false); $this->mockView->expects($this->any())->method('getTypoScriptObject')->will($this->returnValue($this->mockTemplateImplementation)); $this->editableViewHelper->initializeArguments(); }
/** * @param FluidView $view` */ protected function initializeView(FluidView $view) { $captcha = new Captcha(); $captcha->setPublicKey($this->captchaSettings['publicKey']); $view->assignMultiple(['captcha' => $captcha->displayHTML('clean'), 'jiuJitsuOptions' => $this->profileService->getJiuJitsuOptions(), 'buJitsuDoOptions' => $this->profileService->getBuJitsuDoOptions()]); }
/** * @param FluidView $fluidView * @return void */ protected function initializeView(FluidView $fluidView) { $decodedProject = $this->getProjectData($this['project']); $fluidView->assign('project', $decodedProject); }
protected function initializeView(Helpers\FluidView $view) { $view->assign('news', $this->getNewsFromCurrentRequest()); }