本文整理汇总了PHP中TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::start方法的典型用法代码示例。如果您正苦于以下问题:PHP ContentObjectRenderer::start方法的具体用法?PHP ContentObjectRenderer::start怎么用?PHP ContentObjectRenderer::start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer
的用法示例。
在下文中一共展示了ContentObjectRenderer::start方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: main
/**
* Process the link generation
*
* @param string $linkText
* @param array $typoLinkConfiguration TypoLink Configuration array
* @param string $linkHandlerKeyword Define the identifier that an record is given
* @param string $linkHandlerValue Table and uid of the requested record like "tt_news:2"
* @param string $linkParameters Full link params like "record:tt_news:2"
* @param \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer $contentObjectRenderer
* @return string
*/
public function main($linkText, array $typoLinkConfiguration, $linkHandlerKeyword, $linkHandlerValue, $linkParameters, \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer $contentObjectRenderer)
{
$typoScriptConfiguration = $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_linkhandler.'];
$generatedLink = $linkText;
// extract link params like "target", "css-class" or "title"
$additionalLinkParameters = str_replace('"' . $linkHandlerKeyword . ':' . $linkHandlerValue . '"', '', $linkParameters);
$additionalLinkParameters = str_replace($linkHandlerKeyword . ':' . $linkHandlerValue, '', $additionalLinkParameters);
list($recordTableName, $recordUid) = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(':', $linkHandlerValue);
$recordArray = $this->getCurrentRecord($recordTableName, $recordUid);
if ($recordArray && $this->isRecordLinkable($recordTableName, $typoScriptConfiguration, $recordArray)) {
$this->localContentObject = clone $contentObjectRenderer;
$this->localContentObject->start($recordArray, '');
unset($typoLinkConfiguration['parameter']);
$typoScriptConfiguration[$recordTableName . '.']['parameter'] .= $additionalLinkParameters;
$currentLinkConfigurationArray = $this->mergeTypoScript($typoScriptConfiguration, $typoLinkConfiguration, $recordTableName);
if (isset($currentLinkConfigurationArray['storagePidParameterOverride.'])) {
if (array_key_exists($recordArray['pid'], $currentLinkConfigurationArray['storagePidParameterOverride.'])) {
$currentLinkConfigurationArray['parameter'] = $currentLinkConfigurationArray['storagePidParameterOverride.'][$recordArray['pid']];
}
}
// build the full link to the record
$generatedLink = $this->localContentObject->typoLink($linkText, $currentLinkConfigurationArray);
$this->updateParentLastTypoLinkMember($contentObjectRenderer);
}
return $generatedLink;
}
示例2: __construct
/**
* Constructor for the edit panel
*
* @param DatabaseConnection $databaseConnection
* @param TypoScriptFrontendController $frontendController
* @param FrontendBackendUserAuthentication $backendUser
*/
public function __construct(DatabaseConnection $databaseConnection = NULL, TypoScriptFrontendController $frontendController = NULL, FrontendBackendUserAuthentication $backendUser = NULL)
{
$this->databaseConnection = $databaseConnection ?: $GLOBALS['TYPO3_DB'];
$this->frontendController = $frontendController ?: $GLOBALS['TSFE'];
$this->backendUser = $backendUser ?: $GLOBALS['BE_USER'];
$this->cObj = GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::class);
$this->cObj->start(array());
}
示例3: convertsCommaSeparatedListFromValueToSerializedArrayOfTrimmedValues
/**
* @test
*/
public function convertsCommaSeparatedListFromValueToSerializedArrayOfTrimmedValues()
{
$list = 'abc, def, ghi, jkl, mno, pqr, stu, vwx, yz';
$expected = 'a:9:{i:0;s:3:"abc";i:1;s:3:"def";i:2;s:3:"ghi";i:3;s:3:"jkl";i:4;s:3:"mno";i:5;s:3:"pqr";i:6;s:3:"stu";i:7;s:3:"vwx";i:8;s:2:"yz";}';
$this->contentObject->start(array());
$actual = $this->contentObject->cObjGetSingle(\Tx_Solr_contentobject_Multivalue::CONTENT_OBJECT_NAME, array('value' => $list, 'separator' => ','));
$this->assertEquals($expected, $actual);
}
示例4: __construct
/**
* Constructor for the edit panel
*
* @param mixed $_ Previous the database connection
* @param TypoScriptFrontendController $frontendController
* @param FrontendBackendUserAuthentication $backendUser
*/
public function __construct($_ = null, TypoScriptFrontendController $frontendController = null, FrontendBackendUserAuthentication $backendUser = null)
{
$this->frontendController = $frontendController ?: $GLOBALS['TSFE'];
$this->backendUser = $backendUser ?: $GLOBALS['BE_USER'];
$this->cObj = GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::class);
$this->cObj->start([]);
$this->iconFactory = GeneralUtility::makeInstance(IconFactory::class);
}
示例5: __construct
/**
* Initializes the instance of this class. This constructir sets starting
* point for the sitemap to the current page id
*/
public function __construct()
{
$this->cObj = GeneralUtility::makeInstance('tslib_cObj');
$this->cObj->start(array());
$this->offset = max(0, intval(GeneralUtility::_GET('offset')));
$this->limit = max(0, intval(GeneralUtility::_GET('limit')));
if ($this->limit <= 0) {
$this->limit = 50000;
}
$this->createRenderer();
}
示例6: __construct
/**
* Initializes the instance of this class. This constructir sets starting
* point for the sitemap to the current page id
*/
public function __construct()
{
$this->cObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
$this->cObj->start(array());
$this->offset = max(0, (int) GeneralUtility::_GET('offset'));
$this->limit = max(0, (int) GeneralUtility::_GET('limit'));
if ($this->limit <= 0) {
$this->limit = 50000;
}
$this->createRenderer();
}
示例7: render
/**
* Manipulate values through TypoScript before rendering
*
* @param Answer $answer
* @param string $type "createAction", "confirmationAction", "sender", "receiver"
* @return string
*/
public function render(Answer $answer, $type)
{
$value = $this->renderChildren();
if ($answer->getField()) {
if (!empty($this->typoScriptContext[$this->typeToTsType[$type] . '.'][$answer->getField()->getMarker()])) {
$this->contentObjectRenderer->start($answer->_getProperties());
$value = $this->contentObjectRenderer->cObjGetSingle($this->typoScriptContext[$this->typeToTsType[$type] . '.'][$answer->getField()->getMarker()], $this->typoScriptContext[$this->typeToTsType[$type] . '.'][$answer->getField()->getMarker() . '.']);
}
}
return $value;
}
示例8: render
/**
* Renders the view
*
* @return string The rendered view
* @api
*/
public function render()
{
$this->contentObjectRenderer->start($this->variables['data'], 'pages');
$this->settings = $this->variables['settings'];
$this->page = $this->factory->createFromAssociativeArray($this->variables['data']);
$data = ['@context' => ['@vocab' => 'https://schema.org/'], '@type' => 'BlogPosting', '@id' => $this->getGlobalIdentifier(), 'dateModified' => $this->page->getLastUpdatedAt()->format('Y-m-d'), 'datePublished' => $this->page->getCreatedAt()->format('Y-m-d'), 'author' => $this->getAuthor(), 'publisher' => $this->getPublisher(), 'headline' => $this->page->getTitle(), 'description' => strip_tags($this->page->getAbstract()), 'keywords' => $this->page->getKeywords(), 'mainEntityOfPage' => ['@id' => $this->getGlobalIdentifier()]];
$teaserImage = $this->page->getTeaserImage();
if (!is_null($teaserImage)) {
$data['image'] = ['@type' => 'ImageObject', 'url' => '/' . $teaserImage->getValue(), 'width' => '546', 'height' => '171'];
}
return json_encode($data, JSON_PRETTY_PRINT | JSON_FORCE_OBJECT);
}
示例9: savePreflightFinisher
/**
* Preperation function for every table
*
* @return void
*/
public function savePreflightFinisher()
{
if ($this->isSaveToAnyTableActivated()) {
$this->addArrayToDataArray($this->mailRepository->getVariablesWithMarkersFromMail($this->mail));
foreach ((array) array_keys($this->configuration) as $tableKey) {
$table = StringUtility::removeLastDot($tableKey);
$this->contentObject->start($this->getDataArray());
$tableConfiguration = $this->configuration[$tableKey];
if ($this->isSaveToAnyTableActivatedForSpecifiedTable($tableConfiguration)) {
$this->saveSpecifiedTablePreflight($table, $tableConfiguration);
}
}
}
}
示例10: setUp
public function setUp()
{
$this->template = $this->getMock('TYPO3\\CMS\\Core\\TypoScript\\TemplateService', array('getFileName', 'linkData'));
$this->tsfe = $this->getMock('TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController', array(), array(), '', FALSE);
$this->tsfe->tmpl = $this->template;
$this->tsfe->config = array();
$sysPageMock = $this->getMock('TYPO3\\CMS\\Frontend\\Page\\PageRepository');
$this->tsfe->sys_page = $sysPageMock;
$GLOBALS['TSFE'] = $this->tsfe;
$GLOBALS['TSFE']->csConvObj = new \TYPO3\CMS\Core\Charset\CharsetConverter();
$GLOBALS['TSFE']->renderCharset = 'utf-8';
$GLOBALS['TYPO3_CONF_VARS']['SYS']['TYPO3\\CMS\\Core\\Charset\\CharsetConverter_utils'] = 'mbstring';
$this->cObj = $this->getAccessibleMock('\\TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer', array('dummy'));
$this->cObj->start(array(), 'tt_content');
}
示例11: send
/**
* SendPost - Send values via curl to target
*
* @param User $user User properties
* @return void
*/
public function send(User $user)
{
$this->initialize($user);
$this->contentObject->start($this->properties);
if ($this->isTurnedOn()) {
$curlObject = curl_init();
curl_setopt($curlObject, CURLOPT_URL, $this->getUri());
curl_setopt($curlObject, CURLOPT_POST, 1);
curl_setopt($curlObject, CURLOPT_POSTFIELDS, $this->getData());
curl_setopt($curlObject, CURLOPT_RETURNTRANSFER, true);
curl_exec($curlObject);
curl_close($curlObject);
$this->log();
}
}
示例12: 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.'];
}
示例13: getFromTypoScriptContentObject
/**
* Get from TypoScript content object like
*
* # direct value
* plugin.tx_powermail.settings.setup.prefill.marker = TEXT
* plugin.tx_powermail.settings.setup.prefill.marker.value = red
*
* # multiple value
* plugin.tx_powermail.settings.setup.prefill.marker.0 = TEXT
* plugin.tx_powermail.settings.setup.prefill.marker.0.value = red
*
* @return bool
*/
protected function getFromTypoScriptContentObject()
{
$selected = false;
if (isset($this->settings['prefill.'][$this->getMarker() . '.']) && is_array($this->settings['prefill.'][$this->getMarker() . '.'])) {
$this->contentObjectRenderer->start(ObjectAccess::getGettableProperties($this->getField()));
// Multivalue
if (isset($this->settings['prefill.'][$this->getMarker() . '.']['0'])) {
foreach (array_keys($this->settings['prefill.'][$this->getMarker() . '.']) as $key) {
if (stristr($key, '.')) {
continue;
}
$prefill = $this->contentObjectRenderer->cObjGetSingle($this->settings['prefill.'][$this->getMarker() . '.'][$key], $this->settings['prefill.'][$this->getMarker() . '.'][$key . '.']);
if ($prefill === $this->options[$this->index]['value'] || $prefill === $this->options[$this->index]['label']) {
$selected = true;
}
}
} else {
// Single value
$prefill = $this->contentObjectRenderer->cObjGetSingle($this->settings['prefill.'][$this->getMarker()], $this->settings['prefill.'][$this->getMarker() . '.']);
if ($prefill === $this->options[$this->index]['value'] || $prefill === $this->options[$this->index]['label']) {
$selected = true;
}
}
}
return $selected;
}
示例14: renderChildIntoParentColumn
/**
* renders the columns of the grid container and returns the actual content
*
* @param $columns
* @param array $child
* @param array $parentGridData
* @param array $parentRecordNumbers
* @param array $typoScriptSetup
*
* @return void
*/
public function renderChildIntoParentColumn($columns, &$child, &$parentGridData, &$parentRecordNumbers, $typoScriptSetup = array())
{
$column_number = (int) $child['tx_gridelements_columns'];
$columnKey = $column_number . '.';
if (!isset($typoScriptSetup['columns.'][$columnKey])) {
$columnSetupKey = 'default.';
} else {
$columnSetupKey = $columnKey;
}
if ($child['uid'] > 0) {
// update SYS_LASTCHANGED if necessary
$this->cObj->lastChanged($child['tstamp']);
$this->cObj->start(array_merge($child, $parentGridData), 'tt_content');
$parentRecordNumbers[$columnKey]++;
$this->cObj->parentRecordNumber = $parentRecordNumbers[$columnKey];
// we render each child into the children key to provide them prerendered for usage with your own templating
$child = $this->cObj->cObjGetSingle($typoScriptSetup['columns.'][$columnSetupKey]['renderObj'], $typoScriptSetup['columns.'][$columnSetupKey]['renderObj.']);
// then we assign the prerendered child to the appropriate column
if (isset($columns[$column_number])) {
$parentGridData['tx_gridelements_view_columns'][$column_number] .= $child;
}
unset($columns);
}
unset($typoScriptSetup);
}
示例15: generateLink
/**
* Generates a typolink by using the matching configuration.
*
* @throws \Exception
* @return string
*/
protected function generateLink()
{
if (!array_key_exists($this->configurationKey, $this->configuration)) {
throw new MissingConfigurationException(sprintf('No linkhandler TypoScript configuration found for key %s.', $this->configurationKey), 1448384257);
}
$typoScriptConfiguration = $this->configuration[$this->configurationKey]['typolink.'];
try {
$this->initRecord();
} catch (RecordNotFoundException $e) {
// Unless linking is forced, return only the link text
// @todo: should we not get the record in this case (using \TYPO3\CMS\Frontend\Page\PageRepository::getRawRecord()) otherwise link generation will be pretty meaningless?
if (!$this->configuration[$this->configurationKey]['forceLink']) {
return $this->linkText;
}
}
// Assemble full parameters syntax with additional attributes like target, class or title
$this->linkParameters['url'] = $typoScriptConfiguration['parameter'];
$typoScriptConfiguration['parameter'] = GeneralUtility::makeInstance(TypoLinkCodecService::class)->encode($this->linkParameters);
$hookParams = array('linkInformation' => &$this->linkParameters, 'typoscriptConfiguration' => &$typoScriptConfiguration, 'linkText' => &$this->linkText, 'recordRow' => &$this->record);
if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkhandler']['generateLink'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkhandler']['generateLink'] as $funcRef) {
// @todo: make that clean with an interface
GeneralUtility::callUserFunction($funcRef, $hookParams, $this);
}
}
// Build the full link to the record
$this->localContentObjectRenderer->start($this->record, $this->table);
$this->localContentObjectRenderer->parameters = $this->contentObjectRenderer->parameters;
$link = $this->localContentObjectRenderer->typoLink($this->linkText, $typoScriptConfiguration);
// Make the typolink data available in the parent content object
$this->contentObjectRenderer->lastTypoLinkLD = $this->localContentObjectRenderer->lastTypoLinkLD;
$this->contentObjectRenderer->lastTypoLinkUrl = $this->localContentObjectRenderer->lastTypoLinkUrl;
$this->contentObjectRenderer->lastTypoLinkTarget = $this->localContentObjectRenderer->lastTypoLinkTarget;
return $link;
}