TYPO3 CMS  TYPO3_8-7
TYPO3\CMS\Frontend\Page\PageRepository Class Reference

Public Member Functions

 init ($show_hidden)
 
 getPage ($uid, $disableGroupAccessCheck=false)
 
 getPage_noCheck ($uid)
 
 getFirstWebPage ($uid)
 
 getPageIdFromAlias ($alias)
 
 getPageOverlay ($pageInput, $lUid=-1)
 
 getPagesOverlay (array $pagesInput, $lUid=-1)
 
 getRecordOverlay ($table, $row, $sys_language_content, $OLmode='')
 
 getMenu ($pageId, $fields=' *', $sortField='sorting', $additionalWhereClause='', $checkShortcuts=true)
 
 getMenuForPages (array $pageIds, $fields=' *', $sortField='sorting', $additionalWhereClause='', $checkShortcuts=true)
 
 getDomainStartPage ($domain, $path='', $request_uri='')
 
 getRootLine ($uid, $MP='', $ignoreMPerrors=false)
 
 getPathFromRootline ($rl, $len=20)
 
 getExtURL ($pagerow)
 
 getMountPointInfo ($pageId, $pageRec=false, $prevMountPids=[], $firstPageUid=0)
 
 checkRecord ($table, $uid, $checkPage=0)
 
 getRawRecord ($table, $uid, $fields=' *', $noWSOL=false)
 
 getRecordsByField ($theTable, $theField, $theValue, $whereClause='', $groupBy='', $orderBy='', $limit='')
 
 deleteClause ($table)
 
 enableFields ($table, $show_hidden=-1, $ignore_array=[], $noVersionPreview=false)
 
 getMultipleGroupsWhereClause ($field, $table)
 
 fixVersioningPid ($table, &$rr)
 
 movePlhOL ($table, &$row)
 
 getMovePlaceholder ($table, $uid, $fields=' *')
 
 getWorkspaceVersionOfRecord ($workspace, $table, $uid, $fields=' *', $bypassEnableFieldsCheck=false)
 
 checkWorkspaceAccess ($wsid)
 

Static Public Member Functions

static storeHash ($hash, $data, $ident, $lifetime=0)
 

Public Attributes

 $urltypes = ['', 'http://', 'ftp://', 'mailto:', 'https://']
 
 $where_hid_del = ' AND pages.deleted=0'
 
 $where_groupAccess = ''
 
 $sys_language_uid = 0
 
 $versioningPreview = false
 
 $versioningWorkspaceId = 0
 
 $workspaceCache = []
 
 $error_getRootLine = ''
 
 $error_getRootLine_failPid = 0
 
const DOKTYPE_DEFAULT = 1
 
const DOKTYPE_LINK = 3
 
const DOKTYPE_SHORTCUT = 4
 
const DOKTYPE_BE_USER_SECTION = 6
 
const DOKTYPE_MOUNTPOINT = 7
 
const DOKTYPE_SPACER = 199
 
const DOKTYPE_SYSFOLDER = 254
 
const DOKTYPE_RECYCLER = 255
 
const SHORTCUT_MODE_NONE = 0
 
const SHORTCUT_MODE_FIRST_SUBPAGE = 1
 
const SHORTCUT_MODE_RANDOM_SUBPAGE = 2
 
const SHORTCUT_MODE_PARENT_PAGE = 3
 

Protected Member Functions

 getSubpagesForPages (array $pageIds, $fields=' *', $sortField='sorting', $additionalWhereClause='', $checkShortcuts=true, $parentPages=true)
 
 addMountPointParameterToPage (array $page)
 
 checkValidShortcutOfPage (array $page, $additionalWhereClause)
 
 purgeComputedProperties (array $row)
 
 shouldFieldBeOverlaid ($table, $field, $value)
 
 getTypoScriptFrontendController ()
 
 getBackendUser ()
 

Protected Attributes

 $cache_getPage = []
 
 $cache_getPage_noCheck = []
 
 $cache_getPageIdFromAlias = []
 
 $cache_getMountPointInfo = []
 
 $tableNamesAllowedOnRootLevel
 
 $computedPropertyNames
 

Detailed Description

Page functions, a lot of sql/pages-related functions

Mainly used in the frontend but also in some cases in the backend. It's important to set the right $where_hid_del in the object so that the functions operate properly

See also
::fetch_the_id()

Definition at line 40 of file PageRepository.php.

Member Function Documentation

◆ addMountPointParameterToPage()

TYPO3\CMS\Frontend\Page\PageRepository::addMountPointParameterToPage ( array  $page)
protected

Replaces the given page record with mounted page if required

If the given page record is a mount point in overlay mode, the page record is replaced by the record of the overlaying page. The overlay record is enriched by setting the mount point mapping into the field _MP_PARAM as string for example '23-14'.

In all other cases the given page record is returned as is.

Todo:
Find a better name. The current doesn't hit the point.
Parameters
array$pageThe page record to handle.
Returns
array The given page record or it's replacement.

Definition at line 767 of file PageRepository.php.

References TYPO3\CMS\Frontend\Page\PageRepository\getMountPointInfo(), and TYPO3\CMS\Frontend\Page\PageRepository\getPage().

Referenced by TYPO3\CMS\Frontend\Page\PageRepository\getSubpagesForPages().

◆ checkRecord()

TYPO3\CMS\Frontend\Page\PageRepository::checkRecord (   $table,
  $uid,
  $checkPage = 0 
)

Checks if a record exists and is accessible. The row is returned if everything's OK.

Parameters
string$tableThe table name to search
int$uidThe uid to look up in $table
bool | int$checkPageIf checkPage is set, it's also required that the page on which the record resides is accessible
Returns
array|int Returns array (the record) if OK, otherwise blank/0 (zero)

Definition at line 1149 of file PageRepository.php.

References $GLOBALS, and TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance().

◆ checkValidShortcutOfPage()

TYPO3\CMS\Frontend\Page\PageRepository::checkValidShortcutOfPage ( array  $page,
  $additionalWhereClause 
)
protected

If shortcut, look up if the target exists and is currently visible

Parameters
array$pageThe page to check
string$additionalWhereClauseOptional additional where clauses. Like "AND title like '%blabla%'" for instance.
Returns
array

Definition at line 800 of file PageRepository.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance(), and TYPO3\CMS\Core\Database\Query\QueryHelper\stripLogicalOperatorPrefix().

Referenced by TYPO3\CMS\Frontend\Page\PageRepository\getSubpagesForPages().

◆ checkWorkspaceAccess()

TYPO3\CMS\Frontend\Page\PageRepository::checkWorkspaceAccess (   $wsid)

Checks if user has access to workspace.

Parameters
int$wsidWorkspace ID
Returns
bool true if the backend user has access to a certain workspace

Definition at line 1832 of file PageRepository.php.

References $GLOBALS, TYPO3\CMS\Frontend\Page\PageRepository\getBackendUser(), TYPO3\CMS\Core\Utility\ExtensionManagementUtility\isLoaded(), TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance(), and TYPO3\CMS\Core\Utility\GeneralUtility\SYSLOG_SEVERITY_ERROR.

Referenced by TYPO3\CMS\Frontend\Page\PageRepository\fixVersioningPid().

◆ deleteClause()

TYPO3\CMS\Frontend\Page\PageRepository::deleteClause (   $table)

Returns the "AND NOT deleted" clause for the tablename given IF $GLOBALS['TCA'] configuration points to such a field.

Parameters
string$tableTablename
Returns
string
See also
enableFields()

Definition at line 1343 of file PageRepository.php.

References $GLOBALS.

◆ enableFields()

TYPO3\CMS\Frontend\Page\PageRepository::enableFields (   $table,
  $show_hidden = -1,
  $ignore_array = [],
  $noVersionPreview = false 
)

Returns a part of a WHERE clause which will filter out records with start/end times or hidden/fe_groups fields set to values that should de-select them according to the current time, preview settings or user login. Definitely a frontend function.

Is using the $GLOBALS['TCA'] arrays "ctrl" part where the key "enablefields" determines for each table which of these features applies to that table.

Parameters
string$tableTable name found in the $GLOBALS['TCA'] array
int$show_hiddenIf $show_hidden is set (0/1), any hidden-fields in records are ignored. NOTICE: If you call this function, consider what to do with the show_hidden parameter. Maybe it should be set? See ContentObjectRenderer->enableFields where it's implemented correctly.
array$ignore_arrayArray you can pass where keys can be "disabled", "starttime", "endtime", "fe_group" (keys from "enablefields" in TCA) and if set they will make sure that part of the clause is not added. Thus disables the specific part of the clause. For previewing etc.
bool$noVersionPreviewIf set, enableFields will be applied regardless of any versioning preview settings which might otherwise disable enableFields
Exceptions

Definition at line 1365 of file PageRepository.php.

References $GLOBALS, TYPO3\CMS\Core\Utility\GeneralUtility\callUserFunction(), TYPO3\CMS\Core\Versioning\VersionState\DEFAULT_STATE, TYPO3\CMS\Frontend\Page\PageRepository\getMultipleGroupsWhereClause(), TYPO3\CMS\Frontend\Page\PageRepository\getTypoScriptFrontendController(), TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance(), and TYPO3\CMS\Core\Database\Query\QueryHelper\stripLogicalOperatorPrefix().

Referenced by TYPO3\CMS\Frontend\Page\PageRepository\init().

◆ fixVersioningPid()

TYPO3\CMS\Frontend\Page\PageRepository::fixVersioningPid (   $table,
$rr 
)

Finding online PID for offline version record

ONLY active when backend user is previewing records. MUST NEVER affect a site served which is not previewed by backend users!!!

Will look if the "pid" value of the input record is -1 (it is an offline version) and if the table supports versioning; if so, it will translate the -1 PID into the PID of the original record.

Used whenever you are tracking something back, like making the root line.

Principle; Record offline! => Find online?

Parameters
string$tableTable name
array$rrRecord array passed by reference. As minimum, "pid" and "uid" fields must exist! "t3ver_oid" and "t3ver_wsid" is nice and will save you a DB query.
See also
BackendUtility::fixVersioningPid(), versionOL(), getRootLine()

Definition at line 1515 of file PageRepository.php.

References $GLOBALS, TYPO3\CMS\Core\Type\Enumeration\cast(), TYPO3\CMS\Frontend\Page\PageRepository\checkWorkspaceAccess(), TYPO3\CMS\Core\Versioning\VersionState\DELETE_PLACEHOLDER, TYPO3\CMS\Frontend\Page\PageRepository\getMovePlaceholder(), TYPO3\CMS\Frontend\Page\PageRepository\getRawRecord(), TYPO3\CMS\Frontend\Page\PageRepository\getWorkspaceVersionOfRecord(), TYPO3\CMS\Core\Versioning\VersionState\MOVE_POINTER, TYPO3\CMS\Frontend\Page\PageRepository\movePlhOL(), TYPO3\CMS\Core\Versioning\VersionState\NEW_PLACEHOLDER, and TYPO3\CMS\Frontend\Page\PageRepository\purgeComputedProperties().

◆ getBackendUser()

TYPO3\CMS\Frontend\Page\PageRepository::getBackendUser ( )
protected

Returns the current BE user.

Returns

Definition at line 1949 of file PageRepository.php.

References $GLOBALS.

Referenced by TYPO3\CMS\Frontend\Page\PageRepository\checkWorkspaceAccess().

◆ getDomainStartPage()

TYPO3\CMS\Frontend\Page\PageRepository::getDomainStartPage (   $domain,
  $path = '',
  $request_uri = '' 
)

Will find the page carrying the domain record matching the input domain. Might exit after sending a redirect-header IF a found domain record instructs to do so.

Parameters
string$domainDomain name to search for. Eg. "www.typo3.com". Typical the HTTP_HOST value.
string$pathPath for the current script in domain. Eg. "/somedir/subdir". Typ. supplied by ::getIndpEnv('SCRIPT_NAME')
string$request_uriRequest URI: Used to get parameters from if they should be appended. Typ. supplied by ::getIndpEnv('REQUEST_URI')
Returns
mixed If found, returns integer with page UID where found. Otherwise blank. Might exit if location-header is sent, see description.
See also
::findDomainRecord()

Definition at line 865 of file PageRepository.php.

References TYPO3\CMS\Core\Utility\HttpUtility\HTTP_STATUS_301, TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance(), TYPO3\CMS\Core\Utility\HttpUtility\redirect(), and TYPO3\CMS\Core\Database\Query\QueryHelper\stripLogicalOperatorPrefix().

◆ getExtURL()

TYPO3\CMS\Frontend\Page\PageRepository::getExtURL (   $pagerow)

Returns the URL type for the input page row IF the doktype is set to 3.

Parameters
array$pagerowThe page row to return URL type for
Returns
string|bool The URL from based on the data from "urltype" and "url". False if not found.
See also
::initializeRedirectUrlHandlers()

Definition at line 1003 of file PageRepository.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\getIndpEnv().

◆ getFirstWebPage()

TYPO3\CMS\Frontend\Page\PageRepository::getFirstWebPage (   $uid)

Returns the $row of the first web-page in the tree (for the default menu...)

Parameters
int$uidThe page id for which to fetch first subpages (PID)
Returns
mixed If found: The page record (with overlaid localized fields, if any). If NOT found: blank value (not array!)
See also
::fetch_the_id()

Definition at line 338 of file PageRepository.php.

References TYPO3\CMS\Frontend\Page\PageRepository\getPageOverlay(), TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance(), and TYPO3\CMS\Core\Database\Query\QueryHelper\stripLogicalOperatorPrefix().

◆ getMenu()

TYPO3\CMS\Frontend\Page\PageRepository::getMenu (   $pageId,
  $fields = '*',
  $sortField = 'sorting',
  $additionalWhereClause = '',
  $checkShortcuts = true 
)

Returns an array with page rows for subpages of a certain page ID. This is used for menus in the frontend. If there are mount points in overlay mode the _MP_PARAM field is set to the correct MPvar.

If the $pageId being input does in itself require MPvars to define a correct rootline these must be handled externally to this function.

Parameters
int|int[]$pageId The page id (or array of page ids) for which to fetch subpages (PID)
string$fieldsList of fields to select. Default is "*" = all
string$sortFieldThe field to sort by. Default is "sorting @param string $additionalWhereClause Optional additional where clauses. Like "AND title like 'blabla'" for instance.
bool$checkShortcutsCheck if shortcuts exist, checks by default
Returns
array Array with key/value pairs; keys are page-uid numbers. values are the corresponding page records (with overlaid localized fields, if any)
See also
::getPageShortcut(), ::makeMenu()
,

Definition at line 654 of file PageRepository.php.

References $fields, and TYPO3\CMS\Frontend\Page\PageRepository\getSubpagesForPages().

◆ getMenuForPages()

TYPO3\CMS\Frontend\Page\PageRepository::getMenuForPages ( array  $pageIds,
  $fields = '*',
  $sortField = 'sorting',
  $additionalWhereClause = '',
  $checkShortcuts = true 
)

Returns an array with page-rows for pages with uid in $pageIds.

This is used for menus. If there are mount points in overlay mode the _MP_PARAM field is set to the correct MPvar.

Parameters
int[]$pageIds Array of page ids to fetch
string$fieldsList of fields to select. Default is "*" = all
string$sortFieldThe field to sort by. Default is "sorting"
string$additionalWhereClauseOptional additional where clauses. Like "AND title like '%blabla%'" for instance.
bool$checkShortcutsCheck if shortcuts exist, checks by default
Returns
array Array with key/value pairs; keys are page-uid numbers. values are the corresponding page records (with overlaid localized fields, if any)

Definition at line 672 of file PageRepository.php.

References $fields, and TYPO3\CMS\Frontend\Page\PageRepository\getSubpagesForPages().

◆ getMountPointInfo()

TYPO3\CMS\Frontend\Page\PageRepository::getMountPointInfo (   $pageId,
  $pageRec = false,
  $prevMountPids = [],
  $firstPageUid = 0 
)

Returns a MountPoint array for the specified page

Does a recursive search if the mounted page should be a mount page itself.

Note:

Recursive mount points are not supported by all parts of the core. The usage is discouraged. They may be removed from this method.

See also
: https://decisions.typo3.org/t/supporting-or-prohibiting-recursive-mount-points/165/3

An array will be returned if mount pages are enabled, the correct doktype (7) is set for page and there IS a mount_pid with a valid record.

The optional page record must contain at least uid, pid, doktype, mount_pid,mount_pid_ol. If it is not supplied it will be looked up by the system at additional costs for the lookup.

Returns FALSE if no mount point was found, "-1" if there should have been one, but no connection to it, otherwise an array with information about mount pid and modes.

Parameters
int$pageIdPage id to do the lookup for.
array | bool$pageRecOptional page record for the given page.
array$prevMountPidsInternal register to prevent lookup cycles.
int$firstPageUidThe first page id.
Returns
mixed Mount point array or failure flags (-1, false).
See also

Definition at line 1050 of file PageRepository.php.

References $GLOBALS, and TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance().

Referenced by TYPO3\CMS\Frontend\Page\PageRepository\addMountPointParameterToPage().

◆ getMovePlaceholder()

TYPO3\CMS\Frontend\Page\PageRepository::getMovePlaceholder (   $table,
  $uid,
  $fields = '*' 
)

Returns move placeholder of online (live) version

Parameters
string$tableTable name
int$uidRecord UID of online version
string$fieldsField list, default is *
Returns
array If found, the record, otherwise nothing.
See also
BackendUtility::getMovePlaceholder()

Definition at line 1698 of file PageRepository.php.

References $fields, $GLOBALS, TYPO3\CMS\Core\Type\Enumeration\cast(), TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance(), TYPO3\CMS\Core\Versioning\VersionState\MOVE_PLACEHOLDER, and TYPO3\CMS\Core\Utility\GeneralUtility\trimExplode().

Referenced by TYPO3\CMS\Frontend\Page\PageRepository\fixVersioningPid().

◆ getMultipleGroupsWhereClause()

TYPO3\CMS\Frontend\Page\PageRepository::getMultipleGroupsWhereClause (   $field,
  $table 
)

Creating where-clause for checking group access to elements in enableFields function

Parameters
string$fieldField with group list
string$tableTable name
Returns
string AND sql-clause
See also
enableFields()

Definition at line 1471 of file PageRepository.php.

References TYPO3\CMS\Frontend\Page\PageRepository\getTypoScriptFrontendController(), TYPO3\CMS\Core\Utility\GeneralUtility\intExplode(), and TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance().

Referenced by TYPO3\CMS\Frontend\Page\PageRepository\enableFields().

◆ getPage()

TYPO3\CMS\Frontend\Page\PageRepository::getPage (   $uid,
  $disableGroupAccessCheck = false 
)

Loads the full page record for the given page ID.

The page record is either served from a first-level cache or loaded from the database. If no page can be found, an empty array is returned.

Language overlay and versioning overlay are applied. Mount Point handling is not done, an overlaid Mount Point is not replaced.

The result is conditioned by the public properties where_groupAccess and where_hid_del that are preset by the init() method.

See also
PageRepository::where_groupAccess
PageRepository::where_hid_del
PageRepository::init()

By default the usergroup access check is enabled. Use the second method argument to disable the usergroup access check.

The given UID can be preprocessed by registering a hook class that is implementing the PageRepositoryGetPageHookInterface into the configuration array $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_page.php']['getPage'].

Parameters
int$uidThe page id to look up
bool$disableGroupAccessCheckset to true to disable group access check
Returns
array The resulting page record with overlays or empty array
Exceptions

Definition at line 246 of file PageRepository.php.

References $GLOBALS, TYPO3\CMS\Frontend\Page\PageRepository\getPageOverlay(), TYPO3\CMS\Core\Utility\GeneralUtility\getUserObj(), TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance(), and TYPO3\CMS\Core\Database\Query\QueryHelper\stripLogicalOperatorPrefix().

Referenced by TYPO3\CMS\Frontend\Page\PageRepository\addMountPointParameterToPage().

◆ getPage_noCheck()

TYPO3\CMS\Frontend\Page\PageRepository::getPage_noCheck (   $uid)

Return the $row for the page with uid = $uid WITHOUT checking for ->where_hid_del (start- and endtime or hidden). Only "deleted" is checked!

Parameters
int$uidThe page id to look up
Returns
array The page row with overlaid localized fields. Empty array if no page.
See also
getPage()

Definition at line 304 of file PageRepository.php.

References TYPO3\CMS\Frontend\Page\PageRepository\getPageOverlay(), and TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance().

◆ getPageIdFromAlias()

TYPO3\CMS\Frontend\Page\PageRepository::getPageIdFromAlias (   $alias)

Returns a pagerow for the page with alias $alias

Parameters
string$aliasThe alias to look up the page uid for.
Returns
int Returns page uid (int) if found, otherwise 0 (zero)
See also
::checkAndSetAlias(), ContentObjectRenderer::typoLink()

Definition at line 371 of file PageRepository.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance().

◆ getPageOverlay()

TYPO3\CMS\Frontend\Page\PageRepository::getPageOverlay (   $pageInput,
  $lUid = -1 
)

Returns the relevant page overlay record fields

Parameters
mixed$pageInputIf $pageInput is an integer, it's the pid of the pageOverlay record and thus the page overlay record is returned. If $pageInput is an array, it's a page-record and based on this page record the language record is found and OVERLAID before the page record is returned.
int$lUidLanguage UID if you want to set an alternative value to $this->sys_language_uid which is default. Should be >=0
Exceptions

Definition at line 409 of file PageRepository.php.

References TYPO3\CMS\Frontend\Page\PageRepository\getPagesOverlay().

Referenced by TYPO3\CMS\Frontend\Page\PageRepository\getFirstWebPage(), TYPO3\CMS\Frontend\Page\PageRepository\getPage(), and TYPO3\CMS\Frontend\Page\PageRepository\getPage_noCheck().

◆ getPagesOverlay()

TYPO3\CMS\Frontend\Page\PageRepository::getPagesOverlay ( array  $pagesInput,
  $lUid = -1 
)

Returns the relevant page overlay record fields

Parameters
array$pagesInputArray of integers or array of arrays. If each value is an integer, it's the pids of the pageOverlay records and thus the page overlay records are returned. If each value is an array, it's page-records and based on this page records the language records are found and OVERLAID before the page records are returned.
int$lUidLanguage UID if you want to set an alternative value to $this->sys_language_uid which is default. Should be >=0
Exceptions

Definition at line 427 of file PageRepository.php.

References $GLOBALS, TYPO3\CMS\Frontend\Page\PageRepository\$sys_language_uid, TYPO3\CMS\Core\Utility\GeneralUtility\getUserObj(), and TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance().

Referenced by TYPO3\CMS\Frontend\Page\PageRepository\getPageOverlay(), and TYPO3\CMS\Frontend\Page\PageRepository\getSubpagesForPages().

◆ getPathFromRootline()

TYPO3\CMS\Frontend\Page\PageRepository::getPathFromRootline (   $rl,
  $len = 20 
)

Creates a "path" string for the input root line array titles. Used for writing statistics.

Parameters
array$rlA rootline array!
int$lenThe max length of each title from the rootline.
Returns
string The path in the form "/page title/This is another pageti.../Another page
See also
::getConfigArray()
Deprecated:
since TYPO3 v8, will be removed in TYPO3 v9

Definition at line 981 of file PageRepository.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\fixed_lgd_cs(), and TYPO3\CMS\Core\Utility\GeneralUtility\logDeprecatedFunction().

◆ getRawRecord()

TYPO3\CMS\Frontend\Page\PageRepository::getRawRecord (   $table,
  $uid,
  $fields = '*',
  $noWSOL = false 
)

Returns record no matter what - except if record is deleted

Parameters
string$tableThe table name to search
int$uidThe uid to look up in $table
string$fieldsThe fields to select, default is "*
bool$noWSOLIf set, no version overlay is applied
Returns
mixed Returns array (the record) if found, otherwise blank/0 (zero)
See also
getPage_noCheck()

Definition at line 1200 of file PageRepository.php.

References $fields, $GLOBALS, TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance(), and TYPO3\CMS\Core\Utility\GeneralUtility\trimExplode().

Referenced by TYPO3\CMS\Frontend\Page\PageRepository\fixVersioningPid(), and TYPO3\CMS\Frontend\Page\PageRepository\movePlhOL().

◆ getRecordOverlay()

TYPO3\CMS\Frontend\Page\PageRepository::getRecordOverlay (   $table,
  $row,
  $sys_language_content,
  $OLmode = '' 
)

Creates language-overlay for records in general (where translation is found in records from the same table)

Parameters
string$tableTable name
array$rowRecord to overlay. Must contain uid, pid and $table]['ctrl']['languageField']
int$sys_language_contentPointer to the sys_language uid for content on the site.
string$OLmodeOverlay mode. If "hideNonTranslated" then records without translation will not be returned un-translated but unset (and return value is FALSE)
Exceptions

Definition at line 535 of file PageRepository.php.

References $GLOBALS, TYPO3\CMS\Core\Utility\GeneralUtility\getUserObj(), and TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance().

◆ getRecordsByField()

TYPO3\CMS\Frontend\Page\PageRepository::getRecordsByField (   $theTable,
  $theField,
  $theValue,
  $whereClause = '',
  $groupBy = '',
  $orderBy = '',
  $limit = '' 
)

Selects records based on matching a field (ei. other than UID) with a value

Parameters
string$theTableThe table name to search, eg. "pages" or "tt_content @param string $theField The fieldname to match, eg. "uid" or "alias
string$theValueThe value that fieldname must match, eg. "123" or "frontpage
string$whereClauseOptional additional WHERE clauses put in the end of the query. DO NOT PUT IN GROUP BY, ORDER BY or LIMIT!
string$groupByOptional GROUP BY field(s). If none, supply blank string.
string$orderByOptional ORDER BY field(s). If none, supply blank string.
string$limitOptional LIMIT value ([begin,]max). If none, supply blank string.
Returns
mixed Returns array (the record) if found, otherwise nothing (void)

Definition at line 1238 of file PageRepository.php.

References $GLOBALS, TYPO3\CMS\Core\Utility\GeneralUtility\intExplode(), TYPO3\CMS\Core\Utility\GeneralUtility\logDeprecatedFunction(), TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance(), TYPO3\CMS\Core\Database\Query\QueryHelper\parseGroupBy(), TYPO3\CMS\Core\Database\Query\QueryHelper\parseOrderBy(), and TYPO3\CMS\Core\Database\Query\QueryHelper\stripLogicalOperatorPrefix().

◆ getRootLine()

TYPO3\CMS\Frontend\Page\PageRepository::getRootLine (   $uid,
  $MP = '',
  $ignoreMPerrors = false 
)

Returns array with fields of the pages from here ($uid) and back to the root

NOTICE: This function only takes deleted pages into account! So hidden, starttime and endtime restricted pages are included no matter what.

Further: If any "recycler" page is found (doktype=255) then it will also block for the rootline)

If you want more fields in the rootline records than default such can be added by listing them in $GLOBALS['TYPO3_CONF_VARS']['FE']['addRootLineFields']

Parameters
int$uidThe page uid for which to seek back to the page tree root.
string$MPCommalist of MountPoint parameters, eg. "1-2,3-4" etc. Normally this value comes from the GET var, MP
bool$ignoreMPerrorsIf set, some errors related to Mount Points in root line are ignored.
Exceptions
See also
::getRecordArray

Definition at line 950 of file PageRepository.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance().

◆ getSubpagesForPages()

TYPO3\CMS\Frontend\Page\PageRepository::getSubpagesForPages ( array  $pageIds,
  $fields = '*',
  $sortField = 'sorting',
  $additionalWhereClause = '',
  $checkShortcuts = true,
  $parentPages = true 
)
protected

Internal method used by getMenu() and getMenuForPages() Returns an array with page rows for subpages with pid is in $pageIds or uid is in $pageIds, depending on $parentPages This is used for menus. If there are mount points in overlay mode the _MP_PARAM field is set to the correct MPvar.

If the $pageIds being input does in itself require MPvars to define a correct rootline these must be handled externally to this function.

Parameters
int[]$pageIds The page id (or array of page ids) for which to fetch subpages (PID)
string$fieldsList of fields to select. Default is "*" = all
string$sortFieldThe field to sort by. Default is "sorting @param string $additionalWhereClause Optional additional where clauses. Like "AND title like 'blabla'" for instance.
bool$checkShortcutsCheck if shortcuts exist, checks by default
bool$parentPagesWhether the uid list is meant as list of parent pages or the page itself TRUE means id list is checked against pid field
Returns
array Array with key/value pairs; keys are page-uid numbers. values are the corresponding page records (with overlaid localized fields, if any)
See also
::getPageShortcut(), ::makeMenu()
,

Definition at line 696 of file PageRepository.php.

References $fields, TYPO3\CMS\Frontend\Page\PageRepository\addMountPointParameterToPage(), TYPO3\CMS\Frontend\Page\PageRepository\checkValidShortcutOfPage(), TYPO3\CMS\Frontend\Page\PageRepository\getPagesOverlay(), TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance(), TYPO3\CMS\Core\Database\Query\QueryHelper\parseOrderBy(), TYPO3\CMS\Core\Database\Query\QueryHelper\stripLogicalOperatorPrefix(), and TYPO3\CMS\Core\Utility\GeneralUtility\trimExplode().

Referenced by TYPO3\CMS\Frontend\Page\PageRepository\getMenu(), and TYPO3\CMS\Frontend\Page\PageRepository\getMenuForPages().

◆ getTypoScriptFrontendController()

TYPO3\CMS\Frontend\Page\PageRepository::getTypoScriptFrontendController ( )
protected

◆ getWorkspaceVersionOfRecord()

TYPO3\CMS\Frontend\Page\PageRepository::getWorkspaceVersionOfRecord (   $workspace,
  $table,
  $uid,
  $fields = '*',
  $bypassEnableFieldsCheck = false 
)

Select the version of a record for a workspace

Parameters
int$workspaceWorkspace ID
string$tableTable name to select from
int$uidRecord uid for which to find workspace version.
string$fieldsField list to select
bool$bypassEnableFieldsCheckIf TRUE, enablefields are not checked for.
Returns
mixed If found, return record, otherwise other value: Returns 1 if version was sought for but not found, returns -1/-2 if record (offline/online) existed but had enableFields that would disable it. Returns FALSE if not in workspace or no versioning for record. Notice, that the enablefields of the online record is also tested.
See also
BackendUtility::getWorkspaceVersionOfRecord()

Definition at line 1752 of file PageRepository.php.

References $fields, $GLOBALS, TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance(), and TYPO3\CMS\Core\Utility\GeneralUtility\trimExplode().

Referenced by TYPO3\CMS\Frontend\Page\PageRepository\fixVersioningPid().

◆ init()

TYPO3\CMS\Frontend\Page\PageRepository::init (   $show_hidden)

init() MUST be run directly after creating a new template-object This sets the internal variable $this->where_hid_del to the correct where clause for page records taking deleted/hidden/starttime/endtime/t3ver_state into account

Parameters
bool$show_hiddenIf $show_hidden is TRUE, the hidden-field is ignored!! Normally this should be FALSE. Is used for previewing.
See also
::fetch_the_id(), ::initialize_editor()

Definition at line 175 of file PageRepository.php.

References $GLOBALS, TYPO3\CMS\Frontend\Page\PageRepository\enableFields(), and TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance().

◆ movePlhOL()

TYPO3\CMS\Frontend\Page\PageRepository::movePlhOL (   $table,
$row 
)

Checks if record is a move-placeholder (t3ver_state==VersionState::MOVE_PLACEHOLDER) and if so it will set $row to be the pointed-to live record (and return TRUE) Used from versionOL

Parameters
string$tableTable name
array$rowRow (passed by reference) - only online records...
Returns
bool TRUE if overlay is made.
See also
BackendUtility::movePlhOl()

Definition at line 1652 of file PageRepository.php.

References $GLOBALS, TYPO3\CMS\Core\Type\Enumeration\cast(), TYPO3\CMS\Frontend\Page\PageRepository\getRawRecord(), TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance(), TYPO3\CMS\Core\Versioning\VersionState\MOVE_PLACEHOLDER, and TYPO3\CMS\Frontend\Page\PageRepository\purgeComputedProperties().

Referenced by TYPO3\CMS\Frontend\Page\PageRepository\fixVersioningPid().

◆ purgeComputedProperties()

TYPO3\CMS\Frontend\Page\PageRepository::purgeComputedProperties ( array  $row)
protected

Purges computed properties from database rows, such as _ORIG_uid or _ORIG_pid for instance.

Parameters
array$row
Returns
array

Definition at line 1911 of file PageRepository.php.

Referenced by TYPO3\CMS\Frontend\Page\PageRepository\fixVersioningPid(), and TYPO3\CMS\Frontend\Page\PageRepository\movePlhOL().

◆ shouldFieldBeOverlaid()

TYPO3\CMS\Frontend\Page\PageRepository::shouldFieldBeOverlaid (   $table,
  $field,
  $value 
)
protected

Determine if a field needs an overlay

Parameters
string$tableTCA tablename
string$fieldTCA fieldname
mixed$valueCurrent value of the field
Returns
bool Returns TRUE if a given record field needs to be overlaid
Deprecated:
since TYPO3 v8, will be removed in TYPO3 v9

Definition at line 1930 of file PageRepository.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\logDeprecatedFunction().

◆ storeHash()

static TYPO3\CMS\Frontend\Page\PageRepository::storeHash (   $hash,
  $data,
  $ident,
  $lifetime = 0 
)
static

Stores $data in the 'cache_hash' cache with the hash key, $hash and visual/symbolic identification, $ident

Can be used from your frontend plugins if you like. You can call it directly like PageRepository::storeHash()

Parameters
string$hash32 bit hash string (eg. a md5 hash of a serialized array identifying the data being stored)
mixed$dataThe data to store
string$identIs just a textual identification in order to inform about the content!
int$lifetimeThe lifetime for the cache entry in seconds
See also
tslib_TStemplate::start(), getHash()
Deprecated:
since TYPO3 v8, will be removed in TYPO3 v9, please use the Cache Manager directly to store cache entries

Definition at line 1329 of file PageRepository.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\logDeprecatedFunction(), and TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance().

Member Data Documentation

◆ $cache_getMountPointInfo

TYPO3\CMS\Frontend\Page\PageRepository::$cache_getMountPointInfo = []
protected

Definition at line 121 of file PageRepository.php.

◆ $cache_getPage

TYPO3\CMS\Frontend\Page\PageRepository::$cache_getPage = []
protected

Definition at line 106 of file PageRepository.php.

◆ $cache_getPage_noCheck

TYPO3\CMS\Frontend\Page\PageRepository::$cache_getPage_noCheck = []
protected

Definition at line 111 of file PageRepository.php.

◆ $cache_getPageIdFromAlias

TYPO3\CMS\Frontend\Page\PageRepository::$cache_getPageIdFromAlias = []
protected

Definition at line 116 of file PageRepository.php.

◆ $computedPropertyNames

TYPO3\CMS\Frontend\Page\PageRepository::$computedPropertyNames
protected
Initial value:
= [
'_LOCALIZED_UID',
'_MP_PARAM',
'_ORIG_uid',
'_ORIG_pid',
'_PAGES_OVERLAY',
'_PAGES_OVERLAY_UID',
'_PAGES_OVERLAY_LANGUAGE',
]

Definition at line 136 of file PageRepository.php.

◆ $error_getRootLine

TYPO3\CMS\Frontend\Page\PageRepository::$error_getRootLine = ''

Definition at line 94 of file PageRepository.php.

◆ $error_getRootLine_failPid

TYPO3\CMS\Frontend\Page\PageRepository::$error_getRootLine_failPid = 0

Definition at line 101 of file PageRepository.php.

◆ $sys_language_uid

TYPO3\CMS\Frontend\Page\PageRepository::$sys_language_uid = 0

◆ $tableNamesAllowedOnRootLevel

TYPO3\CMS\Frontend\Page\PageRepository::$tableNamesAllowedOnRootLevel
protected
Initial value:
= [
'sys_file_metadata',
'sys_category',
]

Definition at line 126 of file PageRepository.php.

◆ $urltypes

TYPO3\CMS\Frontend\Page\PageRepository::$urltypes = ['', 'http://', 'ftp://', 'mailto:', 'https://']

Definition at line 45 of file PageRepository.php.

◆ $versioningPreview

TYPO3\CMS\Frontend\Page\PageRepository::$versioningPreview = false

Definition at line 75 of file PageRepository.php.

◆ $versioningWorkspaceId

TYPO3\CMS\Frontend\Page\PageRepository::$versioningWorkspaceId = 0

Definition at line 82 of file PageRepository.php.

◆ $where_groupAccess

TYPO3\CMS\Frontend\Page\PageRepository::$where_groupAccess = ''

Definition at line 61 of file PageRepository.php.

◆ $where_hid_del

TYPO3\CMS\Frontend\Page\PageRepository::$where_hid_del = ' AND pages.deleted=0'

Definition at line 54 of file PageRepository.php.

◆ $workspaceCache

TYPO3\CMS\Frontend\Page\PageRepository::$workspaceCache = []

Definition at line 87 of file PageRepository.php.

◆ DOKTYPE_BE_USER_SECTION

◆ DOKTYPE_DEFAULT

const TYPO3\CMS\Frontend\Page\PageRepository::DOKTYPE_DEFAULT = 1

Named constants for "magic numbers" of the field doktype

Definition at line 149 of file PageRepository.php.

Referenced by TYPO3\CMS\WizardCrpages\Controller\CreatePagesWizardModuleFunctionController\getTypeSelectData().

◆ DOKTYPE_LINK

◆ DOKTYPE_MOUNTPOINT

◆ DOKTYPE_RECYCLER

◆ DOKTYPE_SHORTCUT

◆ DOKTYPE_SPACER

◆ DOKTYPE_SYSFOLDER

◆ SHORTCUT_MODE_FIRST_SUBPAGE

const TYPO3\CMS\Frontend\Page\PageRepository::SHORTCUT_MODE_FIRST_SUBPAGE = 1

◆ SHORTCUT_MODE_NONE

const TYPO3\CMS\Frontend\Page\PageRepository::SHORTCUT_MODE_NONE = 0

Named constants for "magic numbers" of the field shortcut_mode

Definition at line 161 of file PageRepository.php.

Referenced by TYPO3\CMS\Backend\Controller\PageLayoutController\getHeaderFlashMessagesForCurrentPid(), and TYPO3\CMS\Backend\Utility\BackendUtility\titleAttribForPages().

◆ SHORTCUT_MODE_PARENT_PAGE

◆ SHORTCUT_MODE_RANDOM_SUBPAGE