当前位置: 首页>>代码示例>>PHP>>正文


PHP RenderingContextInterface::getControllerContext方法代码示例

本文整理汇总了PHP中TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface::getControllerContext方法的典型用法代码示例。如果您正苦于以下问题:PHP RenderingContextInterface::getControllerContext方法的具体用法?PHP RenderingContextInterface::getControllerContext怎么用?PHP RenderingContextInterface::getControllerContext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface的用法示例。


在下文中一共展示了RenderingContextInterface::getControllerContext方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: controllerContextCanBeReadCorrectly

 /**
  * @test
  */
 public function controllerContextCanBeReadCorrectly()
 {
     $controllerContext = $this->getMock(\TYPO3\CMS\Extbase\Mvc\Controller\ControllerContext::class, array('getRequest'), array(), '', false);
     $controllerContext->expects($this->atLeastOnce())->method('getRequest')->willReturn($this->getMock(Request::class));
     $this->renderingContext->setControllerContext($controllerContext);
     $this->assertSame($this->renderingContext->getControllerContext(), $controllerContext);
 }
开发者ID:TYPO3Incubator,项目名称:TYPO3.CMS,代码行数:10,代码来源:RenderingContextTest.php

示例2: renderStatic

 /**
  * @param array $arguments
  * @param callable $renderChildrenClosure
  * @param RenderingContextInterface $renderingContext
  * @return string
  */
 public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
 {
     $path = $arguments['path'];
     $extensionName = $arguments['extensionName'];
     $absolute = $arguments['absolute'];
     if ($extensionName === NULL) {
         $extensionName = $renderingContext->getControllerContext()->getRequest()->getControllerExtensionName();
     }
     $uri = 'EXT:' . GeneralUtility::camelCaseToLowerCaseUnderscored($extensionName) . '/Resources/Public/' . $path;
     $uri = GeneralUtility::getFileAbsFileName($uri);
     $uri = \TYPO3\CMS\Core\Utility\PathUtility::stripPathSitePrefix($uri);
     if (TYPO3_MODE === 'BE' && $absolute === FALSE && $uri !== FALSE) {
         $uri = '../' . $uri;
     }
     if ($absolute === TRUE) {
         $uri = $renderingContext->getControllerContext()->getRequest()->getBaseUri() . $uri;
     }
     return $uri;
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:25,代码来源:ResourceViewHelper.php

示例3: renderStatic

 /**
  * @param array $arguments
  * @param callable $renderChildrenClosure
  * @param RenderingContextInterface $renderingContext
  * @return string
  */
 public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
 {
     $table = $arguments['table'];
     $field = $arguments['field'];
     if ($table === NULL) {
         $currentRequest = $renderingContext->getControllerContext()->getRequest();
         $moduleName = $currentRequest->getPluginName();
         $table = '_MOD_' . $moduleName;
     }
     return '<div class="docheader-csh">' . BackendUtility::cshItem($table, $field) . '</div>';
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:17,代码来源:CshViewHelper.php

示例4: renderStatic

 /**
  * @param array $arguments
  * @param \Closure $renderChildrenClosure
  * @param RenderingContextInterface $renderingContext
  * @return mixed
  */
 public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
 {
     $templateVariableContainer = $renderingContext->getTemplateVariableContainer();
     $partialArguments = $arguments['arguments'];
     if (false === is_array($partialArguments)) {
         $partialArguments = [];
     }
     if (false === isset($partialArguments['settings']) && true === $templateVariableContainer->exists('settings')) {
         $partialArguments['settings'] = $templateVariableContainer->get('settings');
     }
     $substKey = 'INT_SCRIPT.' . $GLOBALS['TSFE']->uniqueHash();
     $content = '<!--' . $substKey . '-->';
     $templateView = GeneralUtility::makeInstance('FluidTYPO3\\Vhs\\View\\UncacheTemplateView');
     $GLOBALS['TSFE']->config['INTincScript'][$substKey] = ['type' => 'POSTUSERFUNC', 'cObj' => serialize($templateView), 'postUserFunc' => 'render', 'conf' => ['partial' => $arguments['partial'], 'section' => $arguments['section'], 'arguments' => $partialArguments, 'controllerContext' => $renderingContext->getControllerContext()], 'content' => $content];
     return $content;
 }
开发者ID:fluidtypo3,项目名称:vhs,代码行数:22,代码来源:UncacheViewHelper.php

示例5: renderStatic

 /**
  * @param array $arguments
  * @param callable $renderChildrenClosure
  * @param RenderingContextInterface $renderingContext
  * @return string
  */
 public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
 {
     $pageUid = $arguments['pageUid'];
     $additionalParams = $arguments['additionalParams'];
     $pageType = $arguments['pageType'];
     $noCache = $arguments['noCache'];
     $noCacheHash = $arguments['noCacheHash'];
     $section = $arguments['section'];
     $linkAccessRestrictedPages = $arguments['linkAccessRestrictedPages'];
     $absolute = $arguments['absolute'];
     $addQueryString = $arguments['addQueryString'];
     $argumentsToBeExcludedFromQueryString = $arguments['argumentsToBeExcludedFromQueryString'];
     $addQueryStringMethod = $arguments['addQueryStringMethod'];
     $uriBuilder = $renderingContext->getControllerContext()->getUriBuilder();
     $uri = $uriBuilder->setTargetPageUid($pageUid)->setTargetPageType($pageType)->setNoCache($noCache)->setUseCacheHash(!$noCacheHash)->setSection($section)->setLinkAccessRestrictedPages($linkAccessRestrictedPages)->setArguments($additionalParams)->setCreateAbsoluteUri($absolute)->setAddQueryString($addQueryString)->setArgumentsToBeExcludedFromQueryString($argumentsToBeExcludedFromQueryString)->setAddQueryStringMethod($addQueryStringMethod)->build();
     return $uri;
 }
开发者ID:TYPO3Incubator,项目名称:TYPO3.CMS,代码行数:23,代码来源:PageViewHelper.php

示例6: preparePipeInstance

 /**
  * @param RenderingContextInterface $renderingContext
  * @param array $arguments
  * @param \Closure $renderChildrenClosure
  * @return PipeInterface
  */
 protected static function preparePipeInstance(RenderingContextInterface $renderingContext, array $arguments, \Closure $renderChildrenClosure = NULL)
 {
     $extensionName = $arguments['extensionName'];
     $controller = $arguments['controller'];
     $controllerContext = $renderingContext->getControllerContext();
     if (TRUE === empty($extensionName)) {
         $extensionName = $controllerContext->getRequest()->getControllerExtensionName();
     }
     if (TRUE === empty($controller)) {
         $controller = $controllerContext->getRequest()->getControllerObjectName();
     }
     /** @var ControllerPipe $pipe */
     $pipe = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager')->get('FluidTYPO3\\Flux\\Outlet\\Pipe\\ControllerPipe');
     $pipe->setAction($arguments['action']);
     $pipe->setController($controller);
     $pipe->setExtensionName($extensionName);
     return $pipe;
 }
开发者ID:busynoggin,项目名称:flux,代码行数:24,代码来源:ControllerViewHelper.php

示例7: renderStatic

 /**
  * @param array $arguments
  * @param \Closure $renderChildrenClosure
  * @param RenderingContextInterface $renderingContext
  * @return mixed
  */
 public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
 {
     $extensionKey = $arguments['extensionKey'];
     $path = $arguments['path'];
     if (null === $extensionKey) {
         $extensionName = $renderingContext->getControllerContext()->getRequest()->getControllerExtensionName();
         $extensionKey = GeneralUtility::camelCaseToLowerCaseUnderscored($extensionName);
     }
     if (!array_key_exists($extensionKey, $GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'])) {
         return null;
     } elseif (!array_key_exists($extensionKey, static::$configurations)) {
         $extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$extensionKey]);
         static::$configurations[$extensionKey] = GeneralUtility::removeDotsFromTS($extConf);
     }
     if (!$path) {
         return static::$configurations[$extensionKey];
     }
     return ObjectAccess::getPropertyPath(static::$configurations[$extensionKey], $path);
 }
开发者ID:fluidtypo3,项目名称:vhs,代码行数:25,代码来源:ExtensionConfigurationViewHelper.php

示例8: renderStatic

 /**
  * @param array $arguments
  * @param callable $renderChildrenClosure
  * @param RenderingContextInterface $renderingContext
  *
  * @return string
  */
 public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
 {
     /** @var \TYPO3\CMS\Extbase\Object\ObjectManager $objectManager */
     $objectManager = GeneralUtility::makeInstance(ObjectManager::class);
     /** @var \TYPO3\CMS\Belog\Domain\Repository\HistoryEntryRepository $historyEntryRepository */
     $historyEntryRepository = $objectManager->get(HistoryEntryRepository::class);
     /** @var \TYPO3\CMS\Belog\Domain\Model\HistoryEntry $historyEntry */
     $historyEntry = $historyEntryRepository->findOneBySysLogUid($arguments['uid']);
     /** @var \TYPO3\CMS\Extbase\Mvc\Controller\ControllerContext $controllerContext */
     $controllerContext = $renderingContext->getControllerContext();
     if (!$historyEntry instanceof HistoryEntry) {
         return '';
     }
     $historyLabel = LocalizationUtility::translate('changesInFields', $controllerContext->getRequest()->getControllerExtensionName(), array($historyEntry->getFieldlist()));
     $historyIcon = IconUtility::getSpriteIcon('actions-document-history-open', array('title' => LocalizationUtility::translate('showHistory', $controllerContext->getRequest()->getControllerExtensionName())));
     $historyHref = BackendUtility::getModuleUrl('record_history', array('sh_uid' => $historyEntry->getUid(), 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')));
     $historyLink = '<a href="' . htmlspecialchars($historyHref) . '">' . $historyIcon . '</a>';
     return $historyLabel . '&nbsp;' . $historyLink;
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:26,代码来源:HistoryEntryViewHelper.php

示例9: renderStatic

 /**
  * @param array $arguments
  * @param callable $renderChildrenClosure
  * @param RenderingContextInterface $renderingContext
  * @return string
  */
 public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
 {
     $getVars = $arguments['getVars'];
     $setVars = $arguments['setVars'];
     $mayMakeShortcut = $GLOBALS['BE_USER']->mayMakeShortcut();
     if ($mayMakeShortcut) {
         $doc = GeneralUtility::makeInstance(DocumentTemplate::class);
         $currentRequest = $renderingContext->getControllerContext()->getRequest();
         $extensionName = $currentRequest->getControllerExtensionName();
         $moduleName = $currentRequest->getPluginName();
         if (count($getVars) === 0) {
             $modulePrefix = strtolower('tx_' . $extensionName . '_' . $moduleName);
             $getVars = array('id', 'M', $modulePrefix);
         }
         $getList = implode(',', $getVars);
         $setList = implode(',', $setVars);
         return $doc->makeShortcutIcon($getList, $setList, $moduleName);
     }
     return '';
 }
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:26,代码来源:ShortcutViewHelper.php

示例10: renderStatic

 /**
  * @param array $arguments
  * @param callable $renderChildrenClosure
  * @param RenderingContextInterface $renderingContext
  *
  * @return string
  */
 public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
 {
     $uid = $arguments['uid'];
     if (isset(static::$workspaceTitleRuntimeCache[$uid])) {
         return static::$workspaceTitleRuntimeCache[$uid];
     }
     if ($uid === 0) {
         static::$workspaceTitleRuntimeCache[$uid] = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('live', $renderingContext->getControllerContext()->getRequest()->getControllerExtensionName());
     } elseif (!\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('workspaces')) {
         static::$workspaceTitleRuntimeCache[$uid] = '';
     } else {
         $objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class);
         $workspaceRepository = $objectManager->get(\TYPO3\CMS\Belog\Domain\Repository\WorkspaceRepository::class);
         /** @var $workspace \TYPO3\CMS\Belog\Domain\Model\Workspace */
         $workspace = $workspaceRepository->findByUid($uid);
         // $workspace may be null, force empty string in this case
         static::$workspaceTitleRuntimeCache[$uid] = $workspace === NULL ? '' : $workspace->getTitle();
     }
     return static::$workspaceTitleRuntimeCache[$uid];
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:27,代码来源:WorkspaceTitleViewHelper.php

示例11: renderStatic

 /**
  * Render the "Base" tag by outputting $request->getBaseUri()
  *
  * Note: renders as <base></base>, because IE6 will else refuse to display
  * the page...
  *
  * @param array $arguments
  * @param \Closure $renderChildrenClosure
  * @param RenderingContextInterface $renderingContext
  *
  * @return string "base"-Tag.
  * @api
  */
 public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
 {
     $controllerContext = $renderingContext->getControllerContext();
     return '<base href="' . htmlspecialchars($controllerContext->getRequest()->getBaseUri()) . '" />';
 }
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:18,代码来源:BaseViewHelper.php

示例12: getComponent

 /**
  * @param RenderingContextInterface $renderingContext
  * @param array $arguments
  * @return ControllerActions
  * @throws \RuntimeException
  */
 public static function getComponent(RenderingContextInterface $renderingContext, array $arguments)
 {
     $extensionName = $arguments['controllerExtensionName'];
     $pluginName = $arguments['pluginName'];
     $actions = $arguments['actions'];
     $controllerName = $arguments['controllerName'];
     $separator = $arguments['separator'];
     $controllerContext = $renderingContext->getControllerContext();
     if (TRUE === $actions instanceof \Traversable) {
         $actions = iterator_to_array($actions);
     }
     if (NULL !== $controllerContext) {
         if (TRUE === empty($extensionName)) {
             $request = $controllerContext->getRequest();
             $extensionName = static::getFullExtensionNameFromRequest($request);
         }
         if (TRUE === empty($pluginName)) {
             $pluginName = $controllerContext->getRequest()->getPluginName();
         }
     }
     if (TRUE === empty($extensionName) && TRUE === empty($pluginName) && 1 > count($actions)) {
         throw new \RuntimeException('Either "actions", or both "extensionName" and "pluginName" must be used on ' . 'flux:field.controllerActions. None were found and none were detected from the ControllerContext Request.', 1346514748);
     }
     /** @var ControllerActions $component */
     $component = static::getPreparedComponent('ControllerActions', $renderingContext, $arguments);
     $component->setExtensionName(static::getExtensionNameFromRenderingContextOrArguments($renderingContext, $arguments));
     $component->setItems($arguments['items']);
     $component->setControllerExtensionName($extensionName);
     $component->setPluginName($pluginName);
     $component->setControllerName($controllerName);
     $component->setActions($actions);
     $component->setExcludeActions($arguments['excludeActions']);
     $component->setPrefixOnRequiredArguments($arguments['prefixOnRequiredArguments']);
     $component->setDisableLocalLanguageLabels($arguments['disableLocalLanguageLabels']);
     $component->setLocalLanguageFileRelativePath($arguments['localLanguageFileRelativePath']);
     $component->setSubActions($arguments['subActions']);
     if (FALSE === empty($separator)) {
         $component->setSeparator($separator);
     }
     return $component;
 }
开发者ID:busynoggin,项目名称:flux,代码行数:47,代码来源:ControllerActionsViewHelper.php

示例13: renderStatic

 /**
  * Return array element by key.
  *
  * @param array $arguments
  * @param \Closure $renderChildrenClosure
  * @param RenderingContextInterface $renderingContext
  * @throws InvalidVariableException
  * @return string
  */
 public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
 {
     $key = $arguments['key'];
     $id = $arguments['id'];
     $default = $arguments['default'];
     $htmlEscape = $arguments['htmlEscape'];
     $extensionName = $arguments['extensionName'];
     $arguments = $arguments['arguments'];
     // Wrapper including a compatibility layer for TYPO3 Flow Translation
     if ($id === null) {
         $id = $key;
     }
     if ((string) $id === '') {
         throw new InvalidVariableException('An argument "key" or "id" has to be provided', 1351584844);
     }
     $request = $renderingContext->getControllerContext()->getRequest();
     $extensionName = $extensionName === null ? $request->getControllerExtensionName() : $extensionName;
     $value = static::translate($id, $extensionName, $arguments);
     if ($value === null) {
         $value = $default !== null ? $default : $renderChildrenClosure();
         if (!empty($arguments)) {
             $value = vsprintf($value, $arguments);
         }
     } elseif ($htmlEscape) {
         $value = htmlspecialchars($value);
     }
     return $value;
 }
开发者ID:TYPO3Incubator,项目名称:TYPO3.CMS,代码行数:37,代码来源:TranslateViewHelper.php

示例14: getExtensionNameFromRenderingContextOrArguments

 /**
  * @param RenderingContextInterface $renderingContext
  * @param array $arguments
  * @throws InvalidVariableException
  * @return string
  */
 protected static function getExtensionNameFromRenderingContextOrArguments(RenderingContextInterface $renderingContext, array $arguments)
 {
     if (TRUE === isset($arguments[static::SCOPE_VARIABLE_EXTENSIONNAME])) {
         return $arguments[static::SCOPE_VARIABLE_EXTENSIONNAME];
     }
     $viewHelperVariableContainer = $renderingContext->getViewHelperVariableContainer();
     if (TRUE === $viewHelperVariableContainer->exists(static::SCOPE, static::SCOPE_VARIABLE_EXTENSIONNAME)) {
         return $viewHelperVariableContainer->get(static::SCOPE, static::SCOPE_VARIABLE_EXTENSIONNAME);
     }
     $controllerContext = $renderingContext->getControllerContext();
     if (NULL !== $controllerContext) {
         $controllerExtensionName = $controllerContext->getRequest()->getControllerExtensionName();
         $controllerVendorName = $controllerContext->getRequest()->getControllerVendorName();
         return (FALSE === empty($controllerVendorName) ? $controllerVendorName . '.' : '') . $controllerExtensionName;
     }
     return 'FluidTYPO3.Flux';
 }
开发者ID:busynoggin,项目名称:flux,代码行数:23,代码来源:AbstractFormViewHelper.php

示例15: controllerContextCanBeReadCorrectly

 /**
  * @test
  */
 public function controllerContextCanBeReadCorrectly()
 {
     $controllerContext = $this->getMock(\TYPO3\CMS\Extbase\Mvc\Controller\ControllerContext::class, array(), array(), '', false);
     $this->renderingContext->setControllerContext($controllerContext);
     $this->assertSame($this->renderingContext->getControllerContext(), $controllerContext);
 }
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:9,代码来源:RenderingContextTest.php


注:本文中的TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface::getControllerContext方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。