本文整理汇总了PHP中TYPO3\CMS\Frontend\Page\PageRepository::getRawRecord方法的典型用法代码示例。如果您正苦于以下问题:PHP PageRepository::getRawRecord方法的具体用法?PHP PageRepository::getRawRecord怎么用?PHP PageRepository::getRawRecord使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Frontend\Page\PageRepository
的用法示例。
在下文中一共展示了PageRepository::getRawRecord方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: determineOriginalShortcutPage
/**
* Determines original shortcut destination in page overlays.
*
* Since the pages records used for menu rendering are overlaid by default,
* the original 'shortcut' value is lost, if a translation did not define one.
* The behaviour in TSFE can be compared to the 'mergeIfNotBlank' feature, but
* it's hardcoded there and not related to the mentioned setting at all.
*
* @param array $page
* @return array
* @todo Once the page_language_overlay behaviour was removed, this method can be removed again
*/
protected function determineOriginalShortcutPage(array $page)
{
// Check if modification is required
if ($GLOBALS['TSFE']->sys_language_uid > 0 && empty($page['shortcut']) && !empty($page['uid']) && !empty($page['_PAGES_OVERLAY']) && !empty($page['_PAGES_OVERLAY_UID'])) {
// Using raw record since the record was overlaid and is correct already:
$originalPage = $this->sys_page->getRawRecord('pages', $page['uid']);
if ($originalPage['shortcut_mode'] === $page['shortcut_mode'] && !empty($originalPage['shortcut'])) {
$page['shortcut'] = $originalPage['shortcut'];
}
}
return $page;
}
示例2: 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) {
// 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 ? $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 = \TYPO3\CMS\Core\Utility\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 (\TYPO3\CMS\Core\Utility\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);
} 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 = \TYPO3\CMS\Core\Utility\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 = $this->parent_cObj->exec_getQuery('pages', array('pidInList' => $id, 'orderBy' => $altSortField));
while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
$GLOBALS['TSFE']->sys_page->versionOL('pages', $row);
if (is_array($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!
unset($row);
}
}
//.........这里部分代码省略.........
示例3: settingLanguage
/**
* Setting the language key that will be used by the current page.
* In this function it should be checked, 1) that this language exists, 2) that a page_overlay_record exists, .. and if not the default language, 0 (zero), should be set.
*
* @return void
* @access private
* @todo Define visibility
*/
public function settingLanguage()
{
if (is_array($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['settingLanguage_preProcess'])) {
$_params = array();
foreach ($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['settingLanguage_preProcess'] as $_funcRef) {
\TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($_funcRef, $_params, $this);
}
}
// Get values from TypoScript:
$this->sys_language_uid = $this->sys_language_content = intval($this->config['config']['sys_language_uid']);
list($this->sys_language_mode, $sys_language_content) = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(';', $this->config['config']['sys_language_mode']);
$this->sys_language_contentOL = $this->config['config']['sys_language_overlay'];
// If sys_language_uid is set to another language than default:
if ($this->sys_language_uid > 0) {
// check whether a shortcut is overwritten by a translated page
// we can only do this now, as this is the place where we get
// to know about translations
$this->checkTranslatedShortcut();
// Request the overlay record for the sys_language_uid:
$olRec = $this->sys_page->getPageOverlay($this->id, $this->sys_language_uid);
if (!count($olRec)) {
// If no OL record exists and a foreign language is asked for...
if ($this->sys_language_uid) {
// If requested translation is not available:
if (\TYPO3\CMS\Core\Utility\GeneralUtility::hideIfNotTranslated($this->page['l18n_cfg'])) {
$this->pageNotFoundAndExit('Page is not available in the requested language.');
} else {
switch ((string) $this->sys_language_mode) {
case 'strict':
$this->pageNotFoundAndExit('Page is not available in the requested language (strict).');
break;
case 'content_fallback':
$fallBackOrder = \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $sys_language_content);
foreach ($fallBackOrder as $orderValue) {
if (!strcmp($orderValue, '0') || count($this->sys_page->getPageOverlay($this->id, $orderValue))) {
$this->sys_language_content = $orderValue;
// Setting content uid (but leaving the sys_language_uid)
break;
}
}
break;
case 'ignore':
$this->sys_language_content = $this->sys_language_uid;
break;
default:
// Default is that everything defaults to the default language...
$this->sys_language_uid = $this->sys_language_content = 0;
break;
}
}
}
} else {
// Setting sys_language if an overlay record was found (which it is only if a language is used)
$this->page = $this->sys_page->getPageOverlay($this->page, $this->sys_language_uid);
}
}
// Setting sys_language_uid inside sys-page:
$this->sys_page->sys_language_uid = $this->sys_language_uid;
// If default translation is not available:
if ((!$this->sys_language_uid || !$this->sys_language_content) && $this->page['l18n_cfg'] & 1) {
$message = 'Page is not available in default language.';
\TYPO3\CMS\Core\Utility\GeneralUtility::sysLog($message, 'cms', \TYPO3\CMS\Core\Utility\GeneralUtility::SYSLOG_SEVERITY_ERROR);
$this->pageNotFoundAndExit($message);
}
// Updating content of the two rootLines IF the language key is set!
if ($this->sys_language_uid && is_array($this->tmpl->rootLine)) {
$this->tmpl->rootLine = $this->sys_page->getRootLine($this->id, $this->MP);
}
if ($this->sys_language_uid && is_array($this->rootLine)) {
$this->rootLine = $this->sys_page->getRootLine($this->id, $this->MP);
}
// Finding the ISO code:
if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('static_info_tables') && $this->sys_language_content) {
// using sys_language_content because the ISO code only (currently) affect content selection from FlexForms - which should follow "sys_language_content"
$sys_language_row = $this->sys_page->getRawRecord('sys_language', $this->sys_language_content, 'static_lang_isocode');
if (is_array($sys_language_row) && $sys_language_row['static_lang_isocode']) {
$stLrow = $this->sys_page->getRawRecord('static_languages', $sys_language_row['static_lang_isocode'], 'lg_iso_2');
$this->sys_language_isocode = $stLrow['lg_iso_2'];
}
}
// Setting softMergeIfNotBlank:
$table_fields = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->config['config']['sys_language_softMergeIfNotBlank'], 1);
foreach ($table_fields as $TF) {
list($tN, $fN) = explode(':', $TF);
$this->TCAcachedExtras[$tN]['l10n_mode'][$fN] = 'mergeIfNotBlank';
}
// Setting softExclude:
$table_fields = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->config['config']['sys_language_softExclude'], 1);
foreach ($table_fields as $TF) {
list($tN, $fN) = explode(':', $TF);
$this->TCAcachedExtras[$tN]['l10n_mode'][$fN] = 'exclude';
}
//.........这里部分代码省略.........
示例4: settingLanguage
/**
* Setting the language key that will be used by the current page.
* In this function it should be checked, 1) that this language exists, 2) that a page_overlay_record exists, .. and if not the default language, 0 (zero), should be set.
*
* @return void
* @access private
*/
public function settingLanguage()
{
if (is_array($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['settingLanguage_preProcess'])) {
$_params = array();
foreach ($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['settingLanguage_preProcess'] as $_funcRef) {
GeneralUtility::callUserFunction($_funcRef, $_params, $this);
}
}
// Initialize charset settings etc.
$this->initLLvars();
// Get values from TypoScript:
$this->sys_language_uid = $this->sys_language_content = (int) $this->config['config']['sys_language_uid'];
list($this->sys_language_mode, $sys_language_content) = GeneralUtility::trimExplode(';', $this->config['config']['sys_language_mode']);
$this->sys_language_contentOL = $this->config['config']['sys_language_overlay'];
// If sys_language_uid is set to another language than default:
if ($this->sys_language_uid > 0) {
// check whether a shortcut is overwritten by a translated page
// we can only do this now, as this is the place where we get
// to know about translations
$this->checkTranslatedShortcut();
// Request the overlay record for the sys_language_uid:
$olRec = $this->sys_page->getPageOverlay($this->id, $this->sys_language_uid);
if (empty($olRec)) {
// If no OL record exists and a foreign language is asked for...
if ($this->sys_language_uid) {
// If requested translation is not available:
if (GeneralUtility::hideIfNotTranslated($this->page['l18n_cfg'])) {
$this->pageNotFoundAndExit('Page is not available in the requested language.');
} else {
switch ((string) $this->sys_language_mode) {
case 'strict':
$this->pageNotFoundAndExit('Page is not available in the requested language (strict).');
break;
case 'content_fallback':
$fallBackOrder = GeneralUtility::intExplode(',', $sys_language_content);
foreach ($fallBackOrder as $orderValue) {
if ((string) $orderValue === '0' || !empty($this->sys_page->getPageOverlay($this->id, $orderValue))) {
$this->sys_language_content = $orderValue;
// Setting content uid (but leaving the sys_language_uid)
break;
}
}
break;
case 'ignore':
$this->sys_language_content = $this->sys_language_uid;
break;
default:
// Default is that everything defaults to the default language...
$this->sys_language_uid = $this->sys_language_content = 0;
}
}
}
} else {
// Setting sys_language if an overlay record was found (which it is only if a language is used)
$this->page = $this->sys_page->getPageOverlay($this->page, $this->sys_language_uid);
}
}
// Setting sys_language_uid inside sys-page:
$this->sys_page->sys_language_uid = $this->sys_language_uid;
// If default translation is not available:
if ((!$this->sys_language_uid || !$this->sys_language_content) && $this->page['l18n_cfg'] & 1) {
$message = 'Page is not available in default language.';
GeneralUtility::sysLog($message, 'cms', GeneralUtility::SYSLOG_SEVERITY_ERROR);
$this->pageNotFoundAndExit($message);
}
$this->updateRootLinesWithTranslations();
// Finding the ISO code for the currently selected language
// fetched by the sys_language record when not fetching content from the default language
if ($this->sys_language_content > 0) {
// using sys_language_content because the ISO code only (currently) affect content selection from FlexForms - which should follow "sys_language_content"
// Set the fourth parameter to TRUE in the next two getRawRecord() calls to
// avoid versioning overlay to be applied as it generates an SQL error
$sys_language_row = $this->sys_page->getRawRecord('sys_language', $this->sys_language_content, 'language_isocode,static_lang_isocode', true);
if (is_array($sys_language_row)) {
if (!empty($sys_language_row['language_isocode'])) {
$this->sys_language_isocode = $sys_language_row['language_isocode'];
} elseif ($sys_language_row['static_lang_isocode'] && ExtensionManagementUtility::isLoaded('static_info_tables')) {
GeneralUtility::deprecationLog('Usage of the field "static_lang_isocode" is discouraged, and will stop working with CMS 8. Use the built-in language field "language_isocode" in your sys_language records.');
$stLrow = $this->sys_page->getRawRecord('static_languages', $sys_language_row['static_lang_isocode'], 'lg_iso_2', true);
$this->sys_language_isocode = $stLrow['lg_iso_2'];
}
}
// the DB value is overriden by TypoScript
if (!empty($this->config['config']['sys_language_isocode'])) {
$this->sys_language_isocode = $this->config['config']['sys_language_isocode'];
}
} else {
// fallback to the TypoScript option when rendering with sys_language_uid=0
// also: use "en" by default
if (!empty($this->config['config']['sys_language_isocode_default'])) {
$this->sys_language_isocode = $this->config['config']['sys_language_isocode_default'];
} else {
$this->sys_language_isocode = $this->lang != 'default' ? $this->lang : 'en';
//.........这里部分代码省略.........