本文整理汇总了PHP中TYPO3\CMS\Core\TypoScript\TemplateService::getFromMPmap方法的典型用法代码示例。如果您正苦于以下问题:PHP TemplateService::getFromMPmap方法的具体用法?PHP TemplateService::getFromMPmap怎么用?PHP TemplateService::getFromMPmap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\TypoScript\TemplateService
的用法示例。
在下文中一共展示了TemplateService::getFromMPmap方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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!
//.........这里部分代码省略.........
示例2: prepareMenuItemsForListMenu
/**
* Fetches all menuitems if special = list is set
*
* @param string $specialValue The value from special.value
* @return array
*/
protected function prepareMenuItemsForListMenu($specialValue)
{
$menuItems = array();
if ($specialValue == '') {
$specialValue = $this->id;
}
$skippedEnableFields = array();
if (!empty($this->mconf['showAccessRestrictedPages'])) {
$skippedEnableFields = array('fe_group' => 1);
}
/** @var RelationHandler $loadDB*/
$loadDB = GeneralUtility::makeInstance(RelationHandler::class);
$loadDB->setFetchAllFields(true);
$loadDB->start($specialValue, 'pages');
$loadDB->additionalWhere['pages'] = $this->parent_cObj->enableFields('pages', false, $skippedEnableFields);
$loadDB->getFromDB();
foreach ($loadDB->itemArray as $val) {
$MP = $this->tmpl->getFromMPmap($val['id']);
// Keep mount point?
$mount_info = $this->sys_page->getMountPointInfo($val['id']);
// 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 (!empty($mp_row)) {
$row = $mp_row;
$row['_MP_PARAM'] = $mount_info['MPvar'];
// Overlays should already have their full MPvars calculated
if ($mount_info['overlay']) {
$MP = $this->tmpl->getFromMPmap($mount_info['mount_pid']);
if ($MP) {
unset($row['_MP_PARAM']);
}
}
} 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);
}
} else {
$row = $loadDB->results['pages'][$val['id']];
}
// Add versioning overlay for current page (to respect workspaces)
if (isset($row) && is_array($row)) {
$this->sys_page->versionOL('pages', $row, true);
}
// Add external MP params, then the row:
if (isset($row) && is_array($row)) {
if ($MP) {
$row['_MP_PARAM'] = $MP . ($row['_MP_PARAM'] ? ',' . $row['_MP_PARAM'] : '');
}
$menuItems[] = $this->sys_page->getPageOverlay($row);
}
}
return $menuItems;
}