本文整理匯總了PHP中TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::getContentObject方法的典型用法代碼示例。如果您正苦於以下問題:PHP ConfigurationManagerInterface::getContentObject方法的具體用法?PHP ConfigurationManagerInterface::getContentObject怎麽用?PHP ConfigurationManagerInterface::getContentObject使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface
的用法示例。
在下文中一共展示了ConfigurationManagerInterface::getContentObject方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: render
/**
* @return mixed
* @throws \Exception
*/
public function render()
{
$contentUid = intval($this->arguments['contentUid']);
if (0 === $contentUid) {
$cObj = $this->configurationManager->getContentObject();
$record = $cObj->data;
}
$field = $this->arguments['field'];
if (false === isset($record) && 0 !== $contentUid) {
if (null !== $field && true === isset($GLOBALS['TCA']['tt_content']['columns'][$field])) {
$selectFields = $field;
} else {
$selectFields = '*';
}
$record = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow($selectFields, 'tt_content', sprintf('uid=%d', $contentUid));
// Add the page overlay
$languageUid = intval($GLOBALS['TSFE']->sys_language_uid);
if (0 !== $languageUid && $GLOBALS['TSFE']->sys_language_contentOL) {
$record = $GLOBALS['TSFE']->sys_page->getRecordOverlay('tt_content', $record, $GLOBALS['TSFE']->sys_language_content, $GLOBALS['TSFE']->sys_language_contentOL);
}
}
if (false === $record && false === isset($record)) {
throw new \Exception(sprintf('Either record with uid %d or field %s do not exist.', $contentUid, $selectFields), 1358679983);
}
// Check if single field or whole record should be returned
$content = null;
if (null === $field) {
$content = $record;
} elseif (true === isset($record[$field])) {
$content = $record[$field];
}
return $this->renderChildrenWithVariableOrReturnInput($content);
}
示例2: render
/**
* @return string
*/
public function render()
{
$value = $this->configurationManager->getContentObject() ? $this->configurationManager->getContentObject()->data : array();
if ($this->arguments['as']) {
$variableNameArr = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode('.', $this->arguments['as'], TRUE, 2);
$variableName = $variableNameArr[0];
$attributePath = $variableNameArr[1];
if ($this->templateVariableContainer->exists($variableName)) {
$oldValue = $this->templateVariableContainer->get($variableName);
$this->templateVariableContainer->remove($variableName);
}
if ($attributePath) {
if ($oldValue && is_array($oldValue)) {
$templateValue = $oldValue;
$templateValue[$attributePath] = $value;
} else {
$templateValue = array($attributePath => $value);
}
} else {
$templateValue = $value;
}
$this->templateVariableContainer->add($variableName, $templateValue);
return '';
} else {
return $value;
}
}
示例3: injectConfigurationManager
/**
* Injects the Configuration Manager and is initializing the framework settings
*
* @param \TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface $configurationManager Instance of the Configuration Manager
* @return void
*/
public function injectConfigurationManager(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface $configurationManager)
{
$this->configurationManager = $configurationManager;
$tsSettings = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK, 'news', 'news_pi1');
$originalSettings = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_SETTINGS);
$propertiesNotAllowedViaFlexForms = ['orderByAllowed'];
foreach ($propertiesNotAllowedViaFlexForms as $property) {
$originalSettings[$property] = $tsSettings['settings'][$property];
}
// Use stdWrap for given defined settings
if (isset($originalSettings['useStdWrap']) && !empty($originalSettings['useStdWrap'])) {
/** @var \TYPO3\CMS\Extbase\Service\TypoScriptService $typoScriptService */
$typoScriptService = GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Service\TypoScriptService::class);
$typoScriptArray = $typoScriptService->convertPlainArrayToTypoScriptArray($originalSettings);
$stdWrapProperties = GeneralUtility::trimExplode(',', $originalSettings['useStdWrap'], true);
foreach ($stdWrapProperties as $key) {
if (is_array($typoScriptArray[$key . '.'])) {
$originalSettings[$key] = $this->configurationManager->getContentObject()->stdWrap($originalSettings[$key], $typoScriptArray[$key . '.']);
}
}
}
// start override
if (isset($tsSettings['settings']['overrideFlexformSettingsIfEmpty'])) {
/** @var \GeorgRinger\News\Utility\TypoScript $typoScriptUtility */
$typoScriptUtility = GeneralUtility::makeInstance(\GeorgRinger\News\Utility\TypoScript::class);
$originalSettings = $typoScriptUtility->override($originalSettings, $tsSettings);
}
$this->settings = $originalSettings;
}
示例4: injectConfigurationManager
/**
* Inject Configuration Manager
*
* @param ConfigurationManagerInterface $configurationManager
* @return void
*/
public function injectConfigurationManager(ConfigurationManagerInterface $configurationManager)
{
$this->configurationManager = $configurationManager;
$this->cObj = $this->configurationManager->getContentObject();
$typoScriptSetup = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
$this->settings = $typoScriptSetup['plugin.']['tx_powermail.']['settings.']['setup.'];
}
示例5: initializeFinisher
/**
* Initialize
*
* @return void
*/
public function initializeFinisher()
{
$this->contentObject = $this->configurationManager->getContentObject();
$this->contentObject->start($this->mailRepository->getVariablesWithMarkersFromMail($this->mail));
$typoScript = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
$this->configuration = $typoScript['plugin.']['tx_powermail.']['settings.']['setup.']['marketing.']['sendPost.'];
}
示例6: renderPreviewSection
/**
* @param ProviderInterface $provider
* @param array $row
* @param Form $form
* @return string|NULL
*/
protected function renderPreviewSection(ProviderInterface $provider, array $row, Form $form = NULL)
{
$templatePathAndFilename = $provider->getTemplatePathAndFilename($row);
if (NULL === $templatePathAndFilename) {
return NULL;
}
$extensionKey = $provider->getExtensionKey($row);
$paths = $provider->getTemplatePaths($row);
$flexformVariables = $provider->getFlexFormValues($row);
$templateVariables = $provider->getTemplateVariables($row);
$variables = RecursiveArrayUtility::merge($templateVariables, $flexformVariables);
$variables['row'] = $row;
$variables['record'] = $row;
if (TRUE === is_object($form)) {
$formLabel = $form->getLabel();
$label = LocalizationUtility::translate($formLabel, $extensionKey);
$variables['label'] = $label;
}
$templatePaths = new TemplatePaths($paths);
$viewContext = new ViewContext($templatePathAndFilename, $extensionKey, self::CONTROLLER_NAME);
$viewContext->setTemplatePaths($templatePaths);
$viewContext->setVariables($variables);
$view = $this->configurationService->getPreparedExposedTemplateView($viewContext);
$existingContentObject = $this->configurationManager->getContentObject();
$contentObject = new ContentObjectRenderer();
$contentObject->start($row, $provider->getTableName($row));
$this->configurationManager->setContentObject($contentObject);
$previewContent = $view->renderStandaloneSection(self::PREVIEW_SECTION, $variables, TRUE);
$this->configurationManager->setContentObject($existingContentObject);
$previewContent = trim($previewContent);
return $previewContent;
}
示例7: injectConfigurationManager
/**
* Injects the Configuration Manager and is initializing the framework settings
*
* @param \TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface $configurationManager Instance of the Configuration Manager
* @return void
*/
public function injectConfigurationManager(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface $configurationManager)
{
$this->configurationManager = $configurationManager;
$tsSettings = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK, 'news', 'news_pi1');
$originalSettings = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_SETTINGS);
// Use stdWrap for given defined settings
if (isset($originalSettings['useStdWrap']) && !empty($originalSettings['useStdWrap'])) {
/** @var \TYPO3\CMS\Extbase\Service\TypoScriptService $typoScriptService */
$typoScriptService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Service\\TypoScriptService');
$typoScriptArray = $typoScriptService->convertPlainArrayToTypoScriptArray($originalSettings);
$stdWrapProperties = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $originalSettings['useStdWrap'], TRUE);
foreach ($stdWrapProperties as $key) {
if (is_array($typoScriptArray[$key . '.'])) {
$originalSettings[$key] = $this->configurationManager->getContentObject()->stdWrap($originalSettings[$key], $typoScriptArray[$key . '.']);
}
}
}
// start override
if (isset($tsSettings['settings']['overrideFlexformSettingsIfEmpty'])) {
/** @var Tx_MooxNews_Utility_TypoScript $typoScriptUtility */
$typoScriptUtility = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Tx_MooxNews_Utility_TypoScript');
$originalSettings = $typoScriptUtility->override($originalSettings, $tsSettings);
}
$this->settings = $originalSettings;
}
示例8: getRenderedRecords
/**
* This function renders an array of tt_content record into an array of rendered content
* it returns a list of elements rendered by typoscript RECORDS function
*
* @param array $rows database rows of records (each item is a tt_content table record)
* @return array
*/
protected function getRenderedRecords($rows)
{
$elements = array();
foreach ($rows as $row) {
$conf = array('tables' => 'tt_content', 'source' => $row['uid'], 'dontCheckPid' => 1);
array_push($elements, $this->configurationManager->getContentObject()->cObjGetSingle('RECORDS', $conf));
}
return $elements;
}
示例9: showSelectedAction
/**
* Show selected person's entry for displaying it
*
*/
public function showSelectedAction()
{
/** @var int $position */
$position = $this->configurationManager->getContentObject()->data['colPos'];
$templateChosen = intval($this->settings['chooseTemplate']);
$selectedPeople = GeneralUtility::intExplode(',', $this->settings['showPeople']);
$persons = $this->personRepository->findPeopleInList($selectedPeople);
$this->view->assign('persons', $persons)->assign('position', $position)->assign('showOrganizationalDetails', $this->settings['showOrganizationalDetails'])->assign('template', $templateChosen);
}
示例10: render
/**
* @param string $action
* @param array $arguments
* @param string $controller
* @param string $extensionName
* @param string $pluginName
* @param string $format
* @param int $pageUid
* @param boolean $cachedAjaxIfPossible TRUE if the URI should be cached (with respect to non-cacheable actions)
* @param boolean $forceContext TRUE if the controller/action/... should be passed
* @param boolean $noAjax
*
* @return string
*/
public function render($action = NULL, array $arguments = array(), $controller = NULL, $extensionName = NULL, $pluginName = NULL, $format = '', $pageUid = NULL, $cachedAjaxIfPossible = TRUE, $forceContext = TRUE, $noAjax = FALSE)
{
$request = $this->mvcDispatcher->getCurrentRequest();
if ($forceContext) {
$requestArguments = $this->controllerContext->getRequest()->getArguments();
$requestArguments = array_merge($requestArguments, $this->hijaxEventDispatcher->getContextArguments());
$requestArguments = array_merge($requestArguments, $arguments);
$arguments = $requestArguments;
}
if ($noAjax) {
return parent::render($action, $arguments, $controller, $extensionName, $pluginName, $pageUid);
} else {
/* @var $listener \EssentialDots\ExtbaseHijax\Event\Listener */
$listener = $this->mvcDispatcher->getCurrentListener();
if ($request) {
if ($action === NULL) {
$action = $request->getControllerActionName();
}
if ($controller === NULL) {
$controller = $request->getControllerName();
}
if ($extensionName === NULL) {
$extensionName = $request->getControllerExtensionName();
}
if ($pluginName === NULL && TYPO3_MODE === 'FE') {
$pluginName = $this->extensionService->getPluginNameByAction($extensionName, $controller, $action);
}
if ($pluginName === NULL) {
$pluginName = $request->getPluginName();
}
$cachedAjaxIfPossible = $cachedAjaxIfPossible ? $this->configurationManager->getContentObject()->getUserObjectType() != ContentObjectRenderer::OBJECTTYPE_USER_INT : false;
if ($cachedAjaxIfPossible) {
/* @var $cacheHash \TYPO3\CMS\Frontend\Page\CacheHashCalculator */
$cacheHash = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\CacheHashCalculator');
$chash = $cacheHash->calculateCacheHash(array('encryptionKey' => $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], 'action' => $action, 'controller' => $controller, 'extension' => $extensionName, 'plugin' => $pluginName, 'arguments' => $this->array_map_recursive('strval', $arguments), 'settingsHash' => $listener->getId()));
}
}
$additionalArguments = array();
$this->hA('r[0][arguments]', $arguments, $additionalArguments);
$language = intval($GLOBALS['TSFE'] ? $GLOBALS['TSFE']->sys_language_content : 0);
$additionalParams = "&r[0][extension]={$extensionName}&r[0][plugin]={$pluginName}&r[0][controller]={$controller}&r[0][action]={$action}&r[0][format]={$format}&r[0][settingsHash]={$listener->getId()}&eID=extbase_hijax_dispatcher&L={$language}";
if ($additionalArguments) {
$additionalParams .= '&' . implode('&', $additionalArguments);
}
if ($chash) {
$additionalParams .= '&r[0][chash]=' . $chash;
}
/* @var $cObj \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer */
$cObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
$uri = $cObj->typoLink('', array('returnLast' => 'url', 'additionalParams' => $additionalParams, 'parameter' => $pageUid ? $pageUid : ($GLOBALS['TSFE'] ? $GLOBALS['TSFE']->id : 0)));
$this->tag->addAttribute('href', $uri);
$this->tag->setContent($this->renderChildren());
$this->tag->forceClosingTag(TRUE);
return $this->tag->render();
}
}
示例11: handleRequest
/**
* Handles the web request. The response will automatically be sent to the client.
*
* @return \TYPO3\CMS\Extbase\Mvc\ResponseInterface|NULL
*/
public function handleRequest()
{
$request = $this->requestBuilder->build();
if ($this->extensionService->isActionCacheable(NULL, NULL, $request->getControllerName(), $request->getControllerActionName())) {
$request->setIsCached(TRUE);
} else {
$contentObject = $this->configurationManager->getContentObject();
if ($contentObject->getUserObjectType() === \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::OBJECTTYPE_USER) {
$contentObject->convertToUserIntObject();
// \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::convertToUserIntObject() will recreate the object, so we have to stop the request here
return NULL;
}
$request->setIsCached(FALSE);
}
/** @var $response \TYPO3\CMS\Extbase\Mvc\ResponseInterface */
$response = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Response');
$this->dispatcher->dispatch($request, $response);
return $response;
}
示例12: render
/**
* Override the title tag
*
* @param boolean $concat
* @return void
*/
public function render($concat = false)
{
$content = $this->renderChildren();
$contentObjectData = $this->configurationManager->getContentObject()->getUserObjectType();
if (!empty($content) && $this->configurationManager->getContentObject()->getUserObjectType() == \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::OBJECTTYPE_USER) {
if ($concat === true) {
$GLOBALS['TSFE']->page['title'] .= $content;
$GLOBALS['TSFE']->indexedDocTitle .= $content;
} else {
$GLOBALS['TSFE']->page['title'] = $content;
$GLOBALS['TSFE']->indexedDocTitle = $content;
}
} else {
if ($concat === true) {
$GLOBALS['TSFE']->content = preg_replace('@<title>(.*?)</title>@i', '<title>' . $content . ' $1</title>', $GLOBALS['TSFE']->content);
} else {
$GLOBALS['TSFE']->content = preg_replace('@<title>(.*?)</title>@i', '<title>' . $content . '</title>', $GLOBALS['TSFE']->content);
}
}
}
示例13: loadConfiguration
private function loadConfiguration()
{
if (!array_key_exists($this->extKey, self::$settingsCache)) {
$this->mergeSettings(unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$this->extKey]));
$this->mergeSettings($this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK));
$this->mergeSettings($this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_SETTINGS));
$flexformSettings = $this->flexFormService->convertFlexFormContentToArray($this->configurationManager->getContentObject()->data['pi_flexform']);
$this->mergeSettings($flexformSettings['settings']);
self::$settingsCache[$this->extKey] = $this->settings;
}
$this->settings = self::$settingsCache[$this->extKey];
}
示例14: initialize
/**
* Init
*
* @return void
*/
public function initialize()
{
$this->extensionName = $this->controllerContext->getRequest()->getControllerExtensionName();
$this->contentObject = $this->configurationManager->getContentObject();
if ($this->arguments['extensionName'] !== null) {
$this->extensionName = $this->arguments['extensionName'];
}
$typoScriptSetup = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_SETTINGS);
if (!empty($typoScriptSetup['setup'])) {
$this->settings = $typoScriptSetup['setup'];
}
}
示例15: render
/**
* @return mixed
*/
public function render()
{
$contentUid = intval($this->arguments['contentUid']);
if (0 === $contentUid) {
$cObj = $this->configurationManager->getContentObject();
$record = $cObj->data;
}
$field = $this->arguments['field'];
if (FALSE === isset($record) && 0 !== $contentUid) {
if (NULL !== $field && TRUE === isset($GLOBALS['TCA']['tt_content']['columns'][$field])) {
$selectFields = $field;
} else {
$selectFields = '*';
}
$record = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow($selectFields, 'tt_content', sprintf('uid=%d', $contentUid));
// Add the page overlay
$languageUid = intval($GLOBALS['TSFE']->sys_language_uid);
if (0 !== $languageUid && $GLOBALS['TSFE']->sys_language_contentOL) {
$record = $GLOBALS['TSFE']->sys_page->getRecordOverlay('tt_content', $record, $GLOBALS['TSFE']->sys_language_content, $GLOBALS['TSFE']->sys_language_contentOL);
}
}
if (FALSE === $record && FALSE === isset($record)) {
throw new \Exception(sprintf('Either record with uid %d or field %s do not exist.', $contentUid, $selectFields), 1358679983);
}
// Check if single field or whole record should be returned
$content = NULL;
if (NULL === $field) {
$content = $record;
} elseif (TRUE === isset($record[$field])) {
$content = $record[$field];
}
// Return if no assign
$as = $this->arguments['as'];
if (TRUE === empty($as)) {
return $content;
}
$variables = array($as => $content);
$output = ViewHelperUtility::renderChildrenWithVariables($this, $this->templateVariableContainer, $variables);
return $output;
}