本文整理汇总了PHP中TYPO3\CMS\Fluid\View\StandaloneView类的典型用法代码示例。如果您正苦于以下问题:PHP StandaloneView类的具体用法?PHP StandaloneView怎么用?PHP StandaloneView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了StandaloneView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderingTest
/**
* @param string $viewHelperTemplate
* @param string $expectedOutput
*
* @test
* @dataProvider viewHelperTemplateSourcesDataProvider
*/
public function renderingTest($viewHelperTemplate, $expectedOutput)
{
$view = new StandaloneView();
$view->getRenderingContext()->getViewHelperResolver()->addNamespace('ft', 'TYPO3Fluid\\FluidTest\\ViewHelpers');
$view->getRenderingContext()->getTemplatePaths()->setTemplateSource($viewHelperTemplate);
$view->assign('settings', ['test' => '<strong>Bla</strong>']);
$this->assertSame($expectedOutput, $view->render());
}
示例2: render
/**
* @param StandaloneView $view
* @param PageRenderer $pageRenderer
* @param LoginController $loginController
* @throws \UnexpectedValueException
*/
public function render(StandaloneView $view, PageRenderer $pageRenderer, LoginController $loginController)
{
GeneralUtility::makeInstance(ObjectManager::class)->get(Dispatcher::class)->dispatch(__CLASS__, self::SIGNAL_getPageRenderer, array($pageRenderer));
$pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/UserPassLogin');
$view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName('EXT:backend/Resources/Private/Templates/UserPassLoginForm.html'));
if (GeneralUtility::getIndpEnv('TYPO3_SSL')) {
$view->assign('presetUsername', GeneralUtility::_GP('u'));
$view->assign('presetPassword', GeneralUtility::_GP('p'));
}
}
示例3: initFluidTemplate
/**
* inits the standalone fluid template
*/
public function initFluidTemplate()
{
$this->resultListView = GeneralUtility::makeInstance('TYPO3\\CMS\\Fluid\\View\\StandaloneView');
$this->resultListView->setPartialRootPaths([$this->conf['partialRootPath']]);
$this->resultListView->setLayoutRootPaths([$this->conf['layoutRootPath']]);
$this->resultListView->setTemplatePathAndFilename($this->conf['templateRootPath'] . 'ResultList.html');
// make settings available in fluid template
$this->resultListView->assign('conf', $this->conf);
$this->resultListView->assign('extConf', $this->extConf);
$this->resultListView->assign('extConfPremium', $this->extConfPremium);
}
示例4: init
/**
* Init some values
*
* @param array $data
*/
protected function init($data)
{
$templatePathAndFilename = GeneralUtility::getFileAbsFileName('EXT:yag/Resources/Private/Templates/Backend/PluginInfo.html');
// Extbase
$this->objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
$configuration['extensionName'] = self::EXTENSION_NAME;
$configuration['pluginName'] = self::PLUGIN_NAME;
$bootstrap = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Core\\Bootstrap');
$bootstrap->initialize($configuration);
// Fluid
$this->fluidRenderer = $this->objectManager->get('TYPO3\\CMS\\Fluid\\View\\StandaloneView');
$this->fluidRenderer->setTemplatePathAndFilename($templatePathAndFilename);
// PluginMode
if (is_array($data)) {
$firstControllerAction = array_shift(explode(';', $this->getDataValue($data, 'switchableControllerActions', 'sDefault')));
$this->pluginMode = str_replace('->', '_', $firstControllerAction);
// Theme
$this->theme = $this->getDataValue($data, 'settings.theme', 'sDefault');
}
}
示例5: render
/**
* Add sys_notes as additional content to the footer of the page module
*
* @param array $params
* @param PageLayoutController $parentObject
* @return string
*/
public function render(array $params = array(), PageLayoutController $parentObject)
{
if ($parentObject->MOD_SETTINGS['function'] == 1) {
$pageInfo = $parentObject->pageinfo;
if ($this->pageCanBeIndexed($pageInfo)) {
// template
$this->loadCss();
$this->loadJavascript();
//load partial paths info from typoscript
$this->view = GeneralUtility::makeInstance(StandaloneView::class);
$this->view->setFormat('html');
$this->view->getRequest()->setControllerExtensionName('cs_seo');
$absoluteResourcesPath = ExtensionManagementUtility::extPath('cs_seo') . 'Resources/';
$layoutPaths = [$absoluteResourcesPath . 'Private/Layouts/'];
$partialPaths = [$absoluteResourcesPath . 'Private/Partials/'];
// load partial paths info from TypoScript
if ($this->isTYPO3VersionGreather6) {
/** @var ObjectManager $objectManager */
$objectManager = GeneralUtility::makeInstance(ObjectManager::class);
/** @var ConfigurationManagerInterface $configurationManager */
$configurationManager = $objectManager->get(ConfigurationManagerInterface::class);
$tsSetup = $configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK, 'csseo');
$layoutPaths = $tsSetup["view"]["layoutRootPaths"] ?: $layoutPaths;
$partialPaths = $tsSetup["view"]["partialRootPaths"] ?: $partialPaths;
}
$this->view->setLayoutRootPaths($layoutPaths);
$this->view->setPartialRootPaths($partialPaths);
$this->view->setTemplatePathAndFilename(ExtensionManagementUtility::extPath('cs_seo') . 'Resources/Private/Templates/PageHook.html');
$results = $this->getResults($pageInfo, $parentObject->current_sys_language);
$score = $results['Percentage'];
unset($results['Percentage']);
$this->view->assignMultiple(['score' => $score, 'results' => $results, 'page' => $parentObject->pageinfo]);
return $this->view->render();
}
}
}
示例6: main
public function main()
{
$result = $error = $url = NULL;
$this->view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName($this->templatePath . 'Main.html'));
if ($this->configuration->isValid()) {
try {
$this->checkPageId();
$url = $this->urlService->getFullUrl($this->pageId, $this->pObj->MOD_SETTINGS);
if (GeneralUtility::_GET('clear')) {
$this->pageSpeedRepository->clearByIdentifier($url);
$this->view->assign('cacheCleared', TRUE);
}
$result = $this->pageSpeedRepository->findByIdentifier($url);
} catch (\HTTP_Request2_ConnectionException $e) {
$error = 'error.http_request.connection';
// todo add log
} catch (\RuntimeException $e) {
$error = $e->getMessage();
}
} else {
$error = 'error.invalid.key';
}
$this->view->assignMultiple(array('lll' => 'LLL:EXT:page_speed/Resources/Private/Language/locallang.xlf:', 'menu' => $this->modifyFuncMenu(BackendUtility::getFuncMenu($this->pObj->id, 'SET[language]', $this->pObj->MOD_SETTINGS['language'], $this->pObj->MOD_MENU['language']), 'language'), 'configuration' => $this->configuration, 'result' => $result, 'url' => $url, 'error' => $error, 'pageId' => $this->pageId));
return $this->view->render();
}
示例7: loadTemplateAction
/**
* @param string $templateName
* @param string $appExtensionKey
* @return string
*/
public function loadTemplateAction($templateName, $appExtensionKey)
{
$appTemplatesPath = sprintf(RoutesFileGenerator::APP_TEMPLATES_FOLDER, ExtensionManagementUtility::extPath($appExtensionKey));
$templateFilePath = $appTemplatesPath . '/' . $templateName;
if (!file_exists($templateFilePath)) {
return '';
} else {
$this->view->setTemplatePathAndFilename($templateFilePath);
return $this->view->render();
}
}
示例8: replaceCallback
/**
* Callback function for rendering quotes.
*
* @param string $matches PCRE matches.
* @return string The quote content.
*/
protected function replaceCallback($matches)
{
$this->view->setControllerContext($this->controllerContext);
$this->view->setTemplatePathAndFilename(File::replaceSiteRelPath($this->settings['template']));
$tmp = $this->postRepository->findByUid((int) $matches[1]);
if (!empty($tmp)) {
$this->view->assign('post', $tmp);
}
$this->view->assign('quote', trim($matches[2]));
return $this->view->render();
}
示例9: renderCallsStandardWrapOnResultStringIfGivenInConfiguration
/**
* @test
*/
public function renderCallsStandardWrapOnResultStringIfGivenInConfiguration()
{
$this->addMockViewToSubject();
$configuration = array('stdWrap.' => array('foo' => 'bar'));
$this->standaloneView->expects($this->any())->method('render')->will($this->returnValue('baz'));
$this->contentObjectRenderer->expects($this->once())->method('stdWrap')->with('baz', array('foo' => 'bar'));
$this->subject->render($configuration);
}
示例10: getPartialSourceReturnsContentOfDefaultPartialFileIfNoPartialExistsForTheSpecifiedFormat
/**
* @test
*/
public function getPartialSourceReturnsContentOfDefaultPartialFileIfNoPartialExistsForTheSpecifiedFormat()
{
$partialRootPath = __DIR__ . '/Fixtures';
$this->view->setPartialRootPath($partialRootPath);
$this->mockRequest->expects($this->once())->method('getFormat')->will($this->returnValue('foo'));
$expectedResult = file_get_contents($partialRootPath . '/LayoutFixture');
$actualResult = $this->view->_call('getPartialSource', 'LayoutFixture');
$this->assertEquals($expectedResult, $actualResult);
}
示例11: getDropDown
/**
* Render drop down
*
* @return string Drop down HTML
*/
public function getDropDown()
{
if (!$this->checkAccess()) {
return '';
}
$request = $this->standaloneView->getRequest();
$request->setControllerExtensionName('backend');
$this->standaloneView->assignMultiple(array('installToolUrl' => BackendUtility::getModuleUrl('system_extinstall'), 'messages' => $this->systemMessages, 'count' => $this->totalCount > $this->maximumCountInBadge ? $this->maximumCountInBadge . '+' : $this->totalCount, 'severityBadgeClass' => $this->severityBadgeClass, 'systemInformation' => $this->systemInformation));
return $this->standaloneView->render();
}
示例12: getLayoutPathAndFilenameWalksStringKeysInReversedOrder
/**
* @test
*/
public function getLayoutPathAndFilenameWalksStringKeysInReversedOrder()
{
$this->view->setLayoutRootPaths(array('default' => 'some/Default/Directory', 'specific' => 'specific/Layout', 'verySpecific' => 'evenMore/Specific/Layout'));
$this->mockRequest->expects($this->any())->method('getFormat')->will($this->returnValue('html'));
$this->view->expects($this->at(0))->method('testFileExistence')->with('evenMore/Specific/Layout/Default.html')->will($this->returnValue(FALSE));
$this->view->expects($this->at(1))->method('testFileExistence')->with('evenMore/Specific/Layout/Default')->will($this->returnValue(FALSE));
$this->view->expects($this->at(2))->method('testFileExistence')->with('specific/Layout/Default.html')->will($this->returnValue(FALSE));
$this->view->expects($this->at(3))->method('testFileExistence')->with('specific/Layout/Default')->will($this->returnValue(FALSE));
$this->view->expects($this->at(4))->method('testFileExistence')->with('some/Default/Directory/Default.html')->will($this->returnValue(FALSE));
$this->view->expects($this->at(5))->method('testFileExistence')->with('some/Default/Directory/Default')->will($this->returnValue(TRUE));
$this->assertEquals('some/Default/Directory/Default', $this->view->_call('getLayoutPathAndFilename'));
}
示例13: renderContent
/**
* renderContent renders sie given Fluidtemplate an adds the given data to the view helper.
* Your templates have to be in "Resources/Private/Html/Content/"
*
* @param array $data Daten für das Fluid-Template
* @param string $templateFile
*
* @return string Content
*/
public function renderContent($data, $templateFile)
{
if (file_exists($templateFile)) {
$this->view->getRequest()->setControllerExtensionName($this->extKey);
$this->view->setTemplatePathAndFilename($templateFile);
$this->view->assign('data', $data);
$content = $this->view->render();
} else {
$content = 'Could not load template!';
}
return $content;
}
示例14: setTemplateWalksStringKeysInReversedOrder
/**
* @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());
}
示例15: makeInterfaceSelectorBox
/**
* Making interface selector:
*
* @return void
*/
public function makeInterfaceSelectorBox()
{
// If interfaces are defined AND no input redirect URL in GET vars:
if ($GLOBALS['TYPO3_CONF_VARS']['BE']['interfaces'] && ($this->isLoginInProgress() || !$this->redirectUrl)) {
$parts = GeneralUtility::trimExplode(',', $GLOBALS['TYPO3_CONF_VARS']['BE']['interfaces']);
if (count($parts) > 1) {
// Only if more than one interface is defined we will show the selector
$interfaces = array('backend' => array('label' => $this->getLanguageService()->getLL('interface.backend'), 'jumpScript' => BackendUtility::getModuleUrl('main'), 'interface' => 'backend'), 'frontend' => array('label' => $this->getLanguageService()->getLL('interface.frontend'), 'jumpScript' => '../', 'interface' => 'frontend'));
$this->view->assign('showInterfaceSelector', true);
$this->view->assign('interfaces', $interfaces);
} elseif (!$this->redirectUrl) {
// If there is only ONE interface value set and no redirect_url is present
$this->view->assign('showInterfaceSelector', false);
$this->view->assign('interface', $parts[0]);
}
}
}