本文整理汇总了PHP中TYPO3\CMS\Frontend\Page\PageRepository::getPageOverlay方法的典型用法代码示例。如果您正苦于以下问题:PHP PageRepository::getPageOverlay方法的具体用法?PHP PageRepository::getPageOverlay怎么用?PHP PageRepository::getPageOverlay使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Frontend\Page\PageRepository
的用法示例。
在下文中一共展示了PageRepository::getPageOverlay方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getRecordArray
/**
* Queries the database for the page record and returns it.
*
* @param integer $uid Page id
* @throws \RuntimeException
* @return array
*/
protected function getRecordArray($uid)
{
if (!isset(self::$pageRecordCache[$this->getCacheIdentifier($uid)])) {
if (!is_array($GLOBALS['TCA']['pages']['columns'])) {
if (isset($GLOBALS['TSFE'])) {
$GLOBALS['TSFE']->includeTCA($GLOBALS['TSFE']->TCAloaded);
}
\TYPO3\CMS\Core\Utility\GeneralUtility::loadTCA('pages');
}
$row = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow(implode(',', self::$rootlineFields), 'pages', 'uid = ' . intval($uid) . ' AND pages.deleted = 0 AND pages.doktype <> ' . \TYPO3\CMS\Frontend\Page\PageRepository::DOKTYPE_RECYCLER);
if (empty($row)) {
throw new \RuntimeException('Could not fetch page data for uid ' . $uid . '.', 1343589451);
}
$this->pageContext->versionOL('pages', $row, FALSE, TRUE);
$this->pageContext->fixVersioningPid('pages', $row);
if (is_array($row)) {
$this->pageContext->getPageOverlay($row, $this->languageUid);
$row = $this->enrichWithRelationFields($uid, $row);
self::$pageRecordCache[$this->getCacheIdentifier($uid)] = $row;
}
}
if (!is_array(self::$pageRecordCache[$this->getCacheIdentifier($uid)])) {
throw new \RuntimeException('Broken rootline. Could not resolve page with uid ' . $uid . '.', 1343464101);
}
return self::$pageRecordCache[$this->getCacheIdentifier($uid)];
}
示例2: getPageOverlay
/**
* Wrapper for \TYPO3\CMS\Frontend\Page\PageRepository::getPageOverlay()
*
* @param mixed $pageInput
* @param integer $languageUid
* @return array
*/
public function getPageOverlay($pageInput, $languageUid = -1)
{
$key = md5(serialize($pageInput) . $languageUid);
if (FALSE === isset(self::$cachedOverlays[$key])) {
self::$cachedOverlays[$key] = self::$pageSelect->getPageOverlay($pageInput, $languageUid);
}
return self::$cachedOverlays[$key];
}
示例3: getPageOverlayByRowWithoutTranslation
/**
* @test
*/
public function getPageOverlayByRowWithoutTranslation()
{
$orig = $this->pageRepo->getPage(4);
$row = $this->pageRepo->getPageOverlay($orig, 1);
$this->assertInternalType('array', $row);
$this->assertEquals(4, $row['uid']);
$this->assertEquals('Dummy 1-4', $row['title']);
//original title
}
示例4: hidePagesIfNotTranslated
/**
* Remove page if not translated
*
* @param array $pages
* @return array
*/
private function hidePagesIfNotTranslated($pages)
{
$language = GeneralUtility::_GET('L');
if (intval($language) !== 0 && intval($this->pluginConfig['1']['urlEntries.']['pages.']['hidePagesIfNotTranslated']) === 1) {
foreach ($pages as $key => $page) {
$pageOverlay = $this->pageRepository->getPageOverlay($page, $language);
if (empty($pageOverlay['_PAGES_OVERLAY'])) {
unset($pages[$key]);
}
}
}
return $pages;
}
示例5: createPathComponentUsingRootline
/**
* Creates a path part of the URL.
*
* @return void
*/
protected function createPathComponentUsingRootline()
{
$mountPointParameter = '';
if (isset($this->urlParameters['MP'])) {
$mountPointParameter = $this->urlParameters['MP'];
unset($this->urlParameters['MP']);
}
$rootLineUtility = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Utility\\RootlineUtility', $this->urlParameters['id'], $mountPointParameter, $this->pageRepository);
/** @var \TYPO3\CMS\Core\Utility\RootlineUtility $rootLineUtility */
$rootLine = $rootLineUtility->get();
// Skip from the root of the tree to the first level of pages
while (count($rootLine) !== 0) {
$page = array_pop($rootLine);
if ($page['uid'] == $this->rootPageId) {
break;
}
}
$enableLanguageOverlay = (int) $this->originalUrlParameters['L'] > 0;
$components = array();
$reversedRootLine = array_reverse($rootLine);
$rootLineMax = count($reversedRootLine) - 1;
for ($current = 0; $current <= $rootLineMax; $current++) {
$page = $reversedRootLine[$current];
// Skip if this page is excluded
if ($page['tx_realurl_exclude'] && $current !== $rootLineMax) {
continue;
}
if ($enableLanguageOverlay) {
$overlay = $this->pageRepository->getPageOverlay($page, (int) $this->originalUrlParameters['L']);
if (is_array($overlay)) {
$page = $overlay;
unset($overlay);
}
}
foreach (self::$pageTitleFields as $field) {
if (isset($page[$field]) && $page[$field] !== '') {
$segment = $this->utility->convertToSafeString($page[$field], $this->separatorCharacter);
if ($segment === '') {
$segment = $this->emptySegmentValue;
}
$components[] = $segment;
$this->appendToEncodedUrl($segment);
continue 2;
}
}
}
if (count($components) > 0) {
$this->addToPathCache(implode('/', $components));
}
}
示例6: getRecordArray
/**
* Queries the database for the page record and returns it.
*
* @param int $uid Page id
* @throws \RuntimeException
* @return array
*/
protected function getRecordArray($uid)
{
$currentCacheIdentifier = $this->getCacheIdentifier($uid);
if (!isset(self::$pageRecordCache[$currentCacheIdentifier])) {
$row = $this->databaseConnection->exec_SELECTgetSingleRow(implode(',', self::$rootlineFields), 'pages', 'uid = ' . (int) $uid . ' AND pages.deleted = 0 AND pages.doktype <> ' . PageRepository::DOKTYPE_RECYCLER);
if (empty($row)) {
throw new \RuntimeException('Could not fetch page data for uid ' . $uid . '.', 1343589451);
}
$this->pageContext->versionOL('pages', $row, false, true);
$this->pageContext->fixVersioningPid('pages', $row);
if (is_array($row)) {
if ($this->languageUid > 0) {
$row = $this->pageContext->getPageOverlay($row, $this->languageUid);
}
$row = $this->enrichWithRelationFields(isset($row['_PAGES_OVERLAY_UID']) ? $row['_PAGES_OVERLAY_UID'] : $uid, $row);
self::$pageRecordCache[$currentCacheIdentifier] = $row;
}
}
if (!is_array(self::$pageRecordCache[$currentCacheIdentifier])) {
throw new \RuntimeException('Broken rootline. Could not resolve page with uid ' . $uid . '.', 1343464101);
}
return self::$pageRecordCache[$currentCacheIdentifier];
}
示例7: createPathComponent
/**
* Creates a path part of the URL.
*
* @return void
*/
protected function createPathComponent()
{
$rooLineUtility = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Utility\\RootlineUtility', $this->urlParameters['id']);
$rootLine = $rooLineUtility->get();
array_pop($rootLine);
if ((int) $this->originalUrlParameters['L'] > 0) {
$enableLanguageOverlay = TRUE;
$fieldList = self::$pageOverlayTitleFields;
} else {
$enableLanguageOverlay = FALSE;
$fieldList = self::$pageTitleFields;
}
$components = array();
foreach (array_reverse($rootLine) as $page) {
if ($enableLanguageOverlay) {
$overlay = $this->pageRepository->getPageOverlay($page, (int) $this->originalUrlParameters['L']);
if (is_array($overlay)) {
$page = $overlay;
unset($overlay);
}
}
foreach ($fieldList as $field) {
if ($page[$field]) {
$segment = $this->utility->convertToSafeString($page[$field]);
if ($segment === '') {
$segment = $this->emptySegmentValue;
}
$components[] = $segment;
$this->appendToEncodedUrl($segment);
continue 2;
}
}
}
if (count($components) > 0) {
$this->addToPathCache(implode('/', $components));
}
}
示例8: makeMenu
/**
* Creates the menu in the internal variables, ready for output.
* Basically this will read the page records needed and fill in the internal $this->menuArr
* Based on a hash of this array and some other variables the $this->result variable will be loaded either from cache OR by calling the generate() method of the class to create the menu for real.
*
* @return void
* @todo Define visibility
*/
public function makeMenu()
{
if ($this->id) {
$this->useCacheHash = FALSE;
// Initializing showAccessRestrictedPages
if ($this->mconf['showAccessRestrictedPages']) {
// SAVING where_groupAccess
$SAVED_where_groupAccess = $this->sys_page->where_groupAccess;
// Temporarily removing fe_group checking!
$this->sys_page->where_groupAccess = '';
}
// Begin production of menu:
$temp = array();
$altSortFieldValue = trim($this->mconf['alternativeSortingField']);
$altSortField = $altSortFieldValue ?: 'sorting';
// ... only for the FIRST level of a HMENU
if ($this->menuNumber == 1 && $this->conf['special']) {
$value = isset($this->conf['special.']['value.']) ? $this->parent_cObj->stdWrap($this->conf['special.']['value'], $this->conf['special.']['value.']) : $this->conf['special.']['value'];
switch ($this->conf['special']) {
case 'userfunction':
$temp = $this->parent_cObj->callUserFunction($this->conf['special.']['userFunc'], array_merge($this->conf['special.'], array('_altSortField' => $altSortField)), '');
if (!is_array($temp)) {
$temp = array();
}
break;
case 'language':
$temp = array();
// Getting current page record NOT overlaid by any translation:
$currentPageWithNoOverlay = $this->sys_page->getRawRecord('pages', $GLOBALS['TSFE']->page['uid']);
// Traverse languages set up:
$languageItems = GeneralUtility::intExplode(',', $value);
foreach ($languageItems as $sUid) {
// Find overlay record:
if ($sUid) {
$lRecs = $this->sys_page->getPageOverlay($GLOBALS['TSFE']->page['uid'], $sUid);
} else {
$lRecs = array();
}
// Checking if the "disabled" state should be set.
if (GeneralUtility::hideIfNotTranslated($GLOBALS['TSFE']->page['l18n_cfg']) && $sUid && !count($lRecs) || $GLOBALS['TSFE']->page['l18n_cfg'] & 1 && (!$sUid || !count($lRecs)) || !$this->conf['special.']['normalWhenNoLanguage'] && $sUid && !count($lRecs)) {
$iState = $GLOBALS['TSFE']->sys_language_uid == $sUid ? 'USERDEF2' : 'USERDEF1';
} else {
$iState = $GLOBALS['TSFE']->sys_language_uid == $sUid ? 'ACT' : 'NO';
}
if ($this->conf['addQueryString']) {
$getVars = $this->parent_cObj->getQueryArguments($this->conf['addQueryString.'], array('L' => $sUid), TRUE);
$this->analyzeCacheHashRequirements($getVars);
} else {
$getVars = '&L=' . $sUid;
}
// Adding menu item:
$temp[] = array_merge(array_merge($currentPageWithNoOverlay, $lRecs), array('ITEM_STATE' => $iState, '_ADD_GETVARS' => $getVars, '_SAFE' => TRUE));
}
break;
case 'directory':
if ($value == '') {
$value = $GLOBALS['TSFE']->page['uid'];
}
$items = GeneralUtility::intExplode(',', $value);
foreach ($items as $id) {
$MP = $this->tmpl->getFromMPmap($id);
// Checking if a page is a mount page and if so, change the ID and set the MP var properly.
$mount_info = $this->sys_page->getMountPointInfo($id);
if (is_array($mount_info)) {
if ($mount_info['overlay']) {
// Overlays should already have their full MPvars calculated:
$MP = $this->tmpl->getFromMPmap($mount_info['mount_pid']);
$MP = $MP ? $MP : $mount_info['MPvar'];
} else {
$MP = ($MP ? $MP . ',' : '') . $mount_info['MPvar'];
}
$id = $mount_info['mount_pid'];
}
// Get sub-pages:
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'pages', 'pid=' . (int) $id . $this->sys_page->where_hid_del, '', $altSortField);
while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
$row = $this->sys_page->getPage($row['uid']);
$GLOBALS['TSFE']->sys_page->versionOL('pages', $row, TRUE);
if (!empty($row)) {
// Keep mount point?
$mount_info = $this->sys_page->getMountPointInfo($row['uid'], $row);
// There is a valid mount point.
if (is_array($mount_info) && $mount_info['overlay']) {
// Using "getPage" is OK since we need the check for enableFields
// AND for type 2 of mount pids we DO require a doktype < 200!
$mp_row = $this->sys_page->getPage($mount_info['mount_pid']);
if (count($mp_row)) {
$row = $mp_row;
$row['_MP_PARAM'] = $mount_info['MPvar'];
} else {
// If the mount point could not be fetched with respect
// to enableFields, unset the row so it does not become a part of the menu!
//.........这里部分代码省略.........
示例9: prepareMenuItemsForKeywordsMenu
/**
* Fetches all menuitems if special = keywords is set
*
* @param string $specialValue The value from special.value
* @param string $sortingField The sorting field
* @return array
*/
protected function prepareMenuItemsForKeywordsMenu($specialValue, $sortingField)
{
$tsfe = $this->getTypoScriptFrontendController();
$menuItems = array();
list($specialValue) = GeneralUtility::intExplode(',', $specialValue);
if (!$specialValue) {
$specialValue = $tsfe->page['uid'];
}
if ($this->conf['special.']['setKeywords'] || $this->conf['special.']['setKeywords.']) {
$kw = isset($this->conf['special.']['setKeywords.']) ? $this->parent_cObj->stdWrap($this->conf['special.']['setKeywords'], $this->conf['special.']['setKeywords.']) : $this->conf['special.']['setKeywords'];
} else {
// The page record of the 'value'.
$value_rec = $this->sys_page->getPage($specialValue);
$kfieldSrc = $this->conf['special.']['keywordsField.']['sourceField'] ? $this->conf['special.']['keywordsField.']['sourceField'] : 'keywords';
// keywords.
$kw = trim($this->parent_cObj->keywords($value_rec[$kfieldSrc]));
}
// *'auto', 'manual', 'tstamp'
$mode = $this->conf['special.']['mode'];
switch ($mode) {
case 'starttime':
$sortField = 'starttime';
break;
case 'lastUpdated':
case 'manual':
$sortField = 'lastUpdated';
break;
case 'tstamp':
$sortField = 'tstamp';
break;
case 'crdate':
$sortField = 'crdate';
break;
default:
$sortField = 'SYS_LASTCHANGED';
}
// Depth, limit, extra where
if (MathUtility::canBeInterpretedAsInteger($this->conf['special.']['depth'])) {
$depth = MathUtility::forceIntegerInRange($this->conf['special.']['depth'], 0, 20);
} else {
$depth = 20;
}
// Max number of items
$limit = MathUtility::forceIntegerInRange($this->conf['special.']['limit'], 0, 100);
$extraWhere = ' AND pages.uid<>' . $specialValue . ($this->conf['includeNotInMenu'] ? '' : ' AND pages.nav_hide=0') . $this->getDoktypeExcludeWhere();
if ($this->conf['special.']['excludeNoSearchPages']) {
$extraWhere .= ' AND pages.no_search=0';
}
// Start point
$eLevel = $this->parent_cObj->getKey(isset($this->conf['special.']['entryLevel.']) ? $this->parent_cObj->stdWrap($this->conf['special.']['entryLevel'], $this->conf['special.']['entryLevel.']) : $this->conf['special.']['entryLevel'], $this->tmpl->rootLine);
$startUid = (int) $this->tmpl->rootLine[$eLevel]['uid'];
// Which field is for keywords
$kfield = 'keywords';
if ($this->conf['special.']['keywordsField']) {
list($kfield) = explode(' ', trim($this->conf['special.']['keywordsField']));
}
// If there are keywords and the startuid is present
if ($kw && $startUid) {
$bA = MathUtility::forceIntegerInRange($this->conf['special.']['beginAtLevel'], 0, 100);
$id_list = $this->parent_cObj->getTreeList(-1 * $startUid, $depth - 1 + $bA, $bA - 1);
$kwArr = explode(',', $kw);
$keyWordsWhereArr = array();
foreach ($kwArr as $word) {
$word = trim($word);
if ($word) {
$keyWordsWhereArr[] = $kfield . ' LIKE \'%' . $this->getDatabaseConnection()->quoteStr($word, 'pages') . '%\'';
}
}
$where = empty($keyWordsWhereArr) ? '' : '(' . implode(' OR ', $keyWordsWhereArr) . ')';
$res = $this->parent_cObj->exec_getQuery('pages', array('pidInList' => '0', 'uidInList' => $id_list, 'where' => $where . $extraWhere, 'orderBy' => $sortingField ?: $sortField . ' desc', 'max' => $limit));
while ($row = $this->getDatabaseConnection()->sql_fetch_assoc($res)) {
$tsfe->sys_page->versionOL('pages', $row, true);
if (is_array($row)) {
$menuItems[$row['uid']] = $this->sys_page->getPageOverlay($row);
}
}
$this->getDatabaseConnection()->sql_free_result($res);
}
return $menuItems;
}
示例10: checkTranslatedShortcut
/**
* Checks whether a translated shortcut page has a different shortcut
* target than the original language page.
* If that is the case, things get corrected to follow that alternative
* shortcut
*
* @return void
* @author Ingo Renner <ingo@typo3.org>
*/
protected function checkTranslatedShortcut()
{
if (!is_null($this->originalShortcutPage)) {
$originalShortcutPageOverlay = $this->sys_page->getPageOverlay($this->originalShortcutPage['uid'], $this->sys_language_uid);
if (!empty($originalShortcutPageOverlay['shortcut']) && $originalShortcutPageOverlay['shortcut'] != $this->id) {
// the translation of the original shortcut page has a different shortcut target!
// set the correct page and id
$shortcut = $this->getPageShortcut($originalShortcutPageOverlay['shortcut'], $originalShortcutPageOverlay['shortcut_mode'], $originalShortcutPageOverlay['uid']);
$this->id = $this->contentPid = $shortcut['uid'];
$this->page = $this->sys_page->getPage($this->id);
// Fix various effects on things like menus f.e.
$this->fetch_the_id();
$this->tmpl->rootLine = array_reverse($this->rootLine);
}
}
}
示例11: createPathComponentUsingRootline
/**
* Creates a path part of the URL.
*
* @return void
*/
protected function createPathComponentUsingRootline()
{
$mountPointParameter = '';
if (isset($this->urlParameters['MP'])) {
$mountPointParameter = $this->urlParameters['MP'];
unset($this->urlParameters['MP']);
}
$rootLineUtility = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Utility\\RootlineUtility', $this->urlParameters['id'], $mountPointParameter, $this->pageRepository);
/** @var \TYPO3\CMS\Core\Utility\RootlineUtility $rootLineUtility */
$rootLine = $rootLineUtility->get();
// Skip from the root of the tree to the first level of pages
while (count($rootLine) !== 0) {
$page = array_pop($rootLine);
if ($page['uid'] == $this->rootPageId) {
break;
}
}
$languageExceptionUids = (string) $this->configuration->get('pagePath/languageExceptionUids');
$enableLanguageOverlay = (int) $this->originalUrlParameters['L'] > 0 && (empty($languageExceptionUids) || !GeneralUtility::inList($languageExceptionUids, $this->sysLanguageUid));
$components = array();
$reversedRootLine = array_reverse($rootLine);
$rootLineMax = count($reversedRootLine) - 1;
for ($current = 0; $current <= $rootLineMax; $current++) {
$page = $reversedRootLine[$current];
// Skip if this page is excluded
if ($page['tx_realurl_exclude'] && $current !== $rootLineMax) {
continue;
}
if ($enableLanguageOverlay) {
$overlay = $this->pageRepository->getPageOverlay($page, (int) $this->originalUrlParameters['L']);
if (is_array($overlay)) {
$page = $overlay;
unset($overlay);
}
}
// if path override is set, use path segment also for all subpages to shorten the url and throw away all segments found so far
if ($page['tx_realurl_pathoverride'] && $page['tx_realurl_pathsegment'] !== '') {
$segment = trim($page['tx_realurl_pathsegment'], '/');
$segments = explode('/', $segment);
array_walk($segments, function (&$segments, $key) {
$segments[$key] = $this->utility->convertToSafeString($segments[$key], $this->separatorCharacter);
});
// Technically we could do with `$components = $segments` but it fills better to have overriden string here
$segment = implode('/', $segments);
$components = array($segment);
continue;
}
foreach (self::$pageTitleFields as $field) {
if (isset($page[$field]) && $page[$field] !== '') {
$segment = $this->utility->convertToSafeString($page[$field], $this->separatorCharacter);
if ($segment === '') {
$segment = $this->emptySegmentValue;
}
$components[] = $segment;
continue 2;
}
}
}
if (count($components) > 0) {
foreach ($components as $segment) {
$this->appendToEncodedUrl($segment);
}
$this->addToPathCache(implode('/', $components));
}
}