‪TYPO3CMS  ‪main
TYPO3\CMS\Core\Domain\Repository\PageRepository Class Reference
Inheritance diagram for TYPO3\CMS\Core\Domain\Repository\PageRepository:

Public Member Functions

 __construct (Context $context=null)
 
array getPage (int $uid, bool $disableGroupAccessCheck=false)
 
array getPage_noCheck (int $uid)
 
array null getLanguageOverlay (string $table, array $originalRow, LanguageAspect $languageAspect=null)
 
array getPageOverlay (int|array $pageInput, LanguageAspect|int $language=null)
 
array getPagesOverlay (array $pagesInput, int|LanguageAspect $language=null)
 
bool isPageSuitableForLanguage (array $page, LanguageAspect $languageAspect)
 
array getMenu ($pageId, $fields=' *', $sortField='sorting', $additionalWhereClause='', $checkShortcuts=true, bool $disableGroupAccessCheck=false)
 
array getMenuForPages (array $pageIds, $fields=' *', $sortField='sorting', $additionalWhereClause='', $checkShortcuts=true, bool $disableGroupAccessCheck=false)
 
 resolveShortcutPage (array $page, bool $resolveRandomSubpages=false, bool $disableGroupAccessCheck=false)
 
mixed getMountPointInfo ($pageId, $pageRec=false, $prevMountPids=[], $firstPageUid=0)
 
int[] filterAccessiblePageIds (array $pageIds, QueryRestrictionContainerInterface $restrictionContainer=null)
 
array null checkRecord (string $table, int $uid, bool $checkPage=false)
 
array null getRawRecord (string $table, int $uid, array $fields=[' *'])
 
string enableFields (string $table, int $show_hidden=-1, array $ignore_array=[])
 
CompositeExpression[] getDefaultConstraints (string $table, array $enableFieldsToIgnore=[], string $tableAlias=null)
 
string getMultipleGroupsWhereClause (string $field, string $table)
 
 versionOL (string $table, &$row, bool $unsetMovePointers=false, bool $bypassEnableFieldsCheck=false)
 
array int bool getWorkspaceVersionOfRecord (string $table, int $uid, array $fields=[' *'], bool $bypassEnableFieldsCheck=false)
 
int[] getPageIdsRecursive (array $pageIds, int $depth)
 
int[] getDescendantPageIdsRecursive (int $startPageId, int $depth, int $begin=0, array $excludePageIds=[], bool $bypassEnableFieldsCheck=false)
 
 checkIfPageIsHidden (int $pageId, LanguageAspect $languageAspect)
 

Public Attributes

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 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

 init ()
 
int[] getLanguageFallbackChain (?LanguageAspect $languageAspect)
 
 getPageOverlaysForLanguage (array $pageUids, LanguageAspect $languageAspect)
 
array null getRecordOverlay (string $table, array $row, LanguageAspect $languageAspect)
 
array getSubpagesForPages (array $pageIds, string $fields=' *', string $sortField='sorting', string $additionalWhereClause='', bool $checkShortcuts=true, bool $parentPages=true, bool $disableGroupAccessCheck=false)
 
array addMountPointParameterToPage (array $page)
 
 checkValidShortcutOfPage (array $page, string $additionalWhereClause)
 
mixed getPageShortcut ($shortcutFieldValue, $shortcutMode, $thisUid, $iteration=20, $pageLog=[], $disableGroupCheck=false, bool $resolveRandomPageShortcuts=true)
 
int[] getSubpagesRecursive (int $pageId, int $depth, int $begin, array $excludePageIds, bool $bypassEnableFieldsCheck, array $prevId_array=[])
 
 purgeComputedProperties (array $row)
 
 getRuntimeCache ()
 
 hasTableWorkspaceSupport (string $tableName)
 

Protected Attributes

string $where_hid_del = 'pages.deleted=0'
 
string $where_groupAccess = ''
 
array $computedPropertyNames
 
Context $context
 

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

For the Context, the workspace aspect is used to determine the workspace. The Workspace ID is relevant for previewing If > 0, versioning preview of other record versions is allowed. This should only be set if the page is not cached and truly previewed by a backend user!

Definition at line 68 of file PageRepository.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Core\Domain\Repository\PageRepository::__construct ( Context  $context = null)

PageRepository constructor to set the base context, this will effectively remove the necessity for setting properties from the outside.

Definition at line 120 of file PageRepository.php.

References TYPO3\CMS\Core\Domain\Repository\PageRepository\$context, and TYPO3\CMS\Core\Domain\Repository\PageRepository\init().

Member Function Documentation

◆ addMountPointParameterToPage()

array TYPO3\CMS\Core\Domain\Repository\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$page‪The page record to handle.
Returns
‪array The given page record or it's replacement.

Definition at line 947 of file PageRepository.php.

References TYPO3\CMS\Core\Domain\Repository\PageRepository\getMountPointInfo(), and TYPO3\CMS\Core\Domain\Repository\PageRepository\getPage().

Referenced by TYPO3\CMS\Core\Domain\Repository\PageRepository\getSubpagesForPages().

◆ checkIfPageIsHidden()

TYPO3\CMS\Core\Domain\Repository\PageRepository::checkIfPageIsHidden ( int  $pageId,
LanguageAspect  $languageAspect 
)

◆ checkRecord()

array null TYPO3\CMS\Core\Domain\Repository\PageRepository::checkRecord ( string  $table,
int  $uid,
bool  $checkPage = false 
)

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

Parameters
string$table‪The table name to search
int$uid‪The uid to look up in $table
bool$checkPage‪If set, it's also required that the page on which the record resides is accessible
Returns
‪array|null Returns array (the record) if OK, otherwise null

Definition at line 1331 of file PageRepository.php.

References $GLOBALS, TYPO3\CMS\Webhooks\Message\$uid, TYPO3\CMS\Core\Database\Connection\PARAM_INT, and TYPO3\CMS\Core\Domain\Repository\PageRepository\versionOL().

◆ checkValidShortcutOfPage()

TYPO3\CMS\Core\Domain\Repository\PageRepository::checkValidShortcutOfPage ( array  $page,
string  $additionalWhereClause 
)
protected

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

Parameters
array$page‪The page to check
string$additionalWhereClause‪Optional additional where clauses. Like "AND title like '%some text%'" for instance.

Definition at line 978 of file PageRepository.php.

References TYPO3\CMS\Core\Database\Connection\PARAM_INT, and TYPO3\CMS\Core\Database\Query\QueryHelper\stripLogicalOperatorPrefix().

Referenced by TYPO3\CMS\Core\Domain\Repository\PageRepository\getSubpagesForPages().

◆ enableFields()

string TYPO3\CMS\Core\Domain\Repository\PageRepository::enableFields ( string  $table,
int  $show_hidden = -1,
array  $ignore_array = [] 
)

Returns 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$table‪Table name found in the $GLOBALS['TCA'] array
int$show_hidden‪If $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_array‪Array 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.
Exceptions

Definition at line 1435 of file PageRepository.php.

References TYPO3\CMS\Core\Domain\Repository\PageRepository\getDefaultConstraints().

◆ filterAccessiblePageIds()

int [] TYPO3\CMS\Core\Domain\Repository\PageRepository::filterAccessiblePageIds ( array  $pageIds,
QueryRestrictionContainerInterface  $restrictionContainer = null 
)

Removes Page UID numbers from the input array which are not available due to QueryRestrictions This is also very helpful to add a custom RestrictionContainer to add custom Restrictions such as "bad doktypes" e.g. RECYCLER doktypes

Parameters
int[]$pageIds‪Array of Page UID numbers to check
QueryRestrictionContainerInterface | null$restrictionContainer
Returns
‪int[] Returns the array of remaining page UID numbers

Definition at line 1292 of file PageRepository.php.

References TYPO3\CMS\Core\Database\Connection\PARAM_INT_ARRAY.

◆ getDefaultConstraints()

CompositeExpression [] TYPO3\CMS\Core\Domain\Repository\PageRepository::getDefaultConstraints ( string  $table,
array  $enableFieldsToIgnore = [],
string  $tableAlias = null 
)

Returns a DB query constraints (part of the 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.

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

Parameters
string$table‪Table name found in the $GLOBALS['TCA'] array
array$enableFieldsToIgnore‪Array where values (or 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.
Returns
‪CompositeExpression[] Constraints built up by the enableField controls

Definition at line 1467 of file PageRepository.php.

References $GLOBALS, TYPO3\CMS\Core\Domain\Repository\PageRepository\getMultipleGroupsWhereClause(), TYPO3\CMS\Core\Domain\Repository\PageRepository\hasTableWorkspaceSupport(), and TYPO3\CMS\Core\Database\Query\QueryHelper\stripLogicalOperatorPrefix().

Referenced by TYPO3\CMS\Core\Domain\Repository\PageRepository\enableFields(), TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser\getFrontendConstraintStatement(), and TYPO3\CMS\Core\Domain\Repository\PageRepository\init().

◆ getDescendantPageIdsRecursive()

int [] TYPO3\CMS\Core\Domain\Repository\PageRepository::getDescendantPageIdsRecursive ( int  $startPageId,
int  $depth,
int  $begin = 0,
array  $excludePageIds = [],
bool  $bypassEnableFieldsCheck = false 
)

Generates a list of Page IDs from $startPageId. List does not include $startPageId itself. Only works on default language level.

Pages that prevent looking for further subpages:

  • ‪deleted pages
  • ‪pages of the Backend User Section (doktype = 6) type
  • ‪pages that have the extendToSubpages set, where starttime, endtime, hidden or fe_group would hide the pages

Apart from that, pages with enable-fields excluding them, will also be removed.

Mount Pages are descended, but note these ID numbers are not useful for links unless the correct MPvar is set.

Parameters
int$startPageId‪The id of the start page from which point in the page tree to descend.
int$depth‪Maximum recursion depth. Use 100 or so to descend "infinitely". Stops when 0 is reached.
int$begin‪An optional integer the level in the tree to start collecting. Zero means 'start right away', 1 = 'next level and out'
array$excludePageIds‪Avoid collecting these pages and their possible subpages
bool$bypassEnableFieldsCheck‪If true, then enableFields and other checks are not evaluated
Returns
‪int[] Returns the list of Page IDs

Definition at line 1873 of file PageRepository.php.

References TYPO3\CMS\Core\Domain\Repository\PageRepository\getMountPointInfo(), TYPO3\CMS\Core\Domain\Repository\PageRepository\getRawRecord(), and TYPO3\CMS\Core\Domain\Repository\PageRepository\getSubpagesRecursive().

Referenced by TYPO3\CMS\Core\Domain\Repository\PageRepository\getPageIdsRecursive().

◆ getLanguageFallbackChain()

int [] TYPO3\CMS\Core\Domain\Repository\PageRepository::getLanguageFallbackChain ( ?LanguageAspect  $languageAspect)
protected

◆ getLanguageOverlay()

array null TYPO3\CMS\Core\Domain\Repository\PageRepository::getLanguageOverlay ( string  $table,
array  $originalRow,
LanguageAspect  $languageAspect = null 
)

Master helper method to overlay a record to a language.

Be aware that for pages the languageId is taken, and for all other records the contentId of the Aspect is used.

Parameters
string$table‪the name of the table, should be a TCA table with localization enabled
array$originalRow‪the current (full-fletched) record.
LanguageAspect | null$languageAspect‪an alternative language aspect if needed (optional)
Returns
‪array|null NULL If overlays were activated but no overlay was found and LanguageAspect was NOT set to MIXED

Definition at line 325 of file PageRepository.php.

References $GLOBALS, TYPO3\CMS\Core\Domain\Repository\PageRepository\getLanguageFallbackChain(), TYPO3\CMS\Core\Domain\Repository\PageRepository\getPageOverlay(), TYPO3\CMS\Core\Domain\Repository\PageRepository\getRecordOverlay(), TYPO3\CMS\Core\Context\LanguageAspect\OVERLAYS_MIXED, and TYPO3\CMS\Core\Context\LanguageAspect\OVERLAYS_ON.

Referenced by TYPO3\CMS\Core\Domain\Repository\PageRepository\getPage(), TYPO3\CMS\Core\Domain\Repository\PageRepository\getPage_noCheck(), and TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbBackend\overlayLanguageAndWorkspaceForSingleRecord().

◆ getMenu()

array TYPO3\CMS\Core\Domain\Repository\PageRepository::getMenu (   $pageId,
  $fields = '*',
  $sortField = 'sorting',
  $additionalWhereClause = '',
  $checkShortcuts = true,
bool  $disableGroupAccessCheck = false 
)

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$fields‪Fields to select, * is the default - If a custom list is set, make sure the list contains the uid field. It's mandatory for further processing of the result row.
string$sortField‪The field to sort by. Default is "sorting @param string $additionalWhereClause Optional additional where clauses. Like "AND title like 'some text'" for instance.
bool$checkShortcuts‪Check 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()
‪\TYPO3\CMS\Frontend\ContentObject\Menu\AbstractMenuContentObject::makeMenu()

Definition at line 789 of file PageRepository.php.

References $fields, and TYPO3\CMS\Core\Domain\Repository\PageRepository\getSubpagesForPages().

Referenced by TYPO3\CMS\Core\Domain\Repository\PageRepository\getPageShortcut().

◆ getMenuForPages()

array TYPO3\CMS\Core\Domain\Repository\PageRepository::getMenuForPages ( array  $pageIds,
  $fields = '*',
  $sortField = 'sorting',
  $additionalWhereClause = '',
  $checkShortcuts = true,
bool  $disableGroupAccessCheck = false 
)

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$fields‪Fields to select, * is the default - If a custom list is set, make sure the list contains the uid field. It's mandatory for further processing of the result row.
string$sortField‪The field to sort by. Default is "sorting"
string$additionalWhereClause‪Optional additional where clauses. Like "AND title like '%some text%'" for instance.
bool$checkShortcuts‪Check 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 813 of file PageRepository.php.

References $fields, and TYPO3\CMS\Core\Domain\Repository\PageRepository\getSubpagesForPages().

◆ getMountPointInfo()

mixed TYPO3\CMS\Core\Domain\Repository\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$pageRec‪Optional page record for the given page.
array$prevMountPids‪Internal register to prevent lookup cycles.
int$firstPageUid‪The first page id.
Returns
‪mixed Mount point array or failure flags (-1, false).
See also
‪\TYPO3\CMS\Frontend\ContentObject\Menu\AbstractMenuContentObject

Definition at line 1204 of file PageRepository.php.

References $GLOBALS, TYPO3\CMS\Core\Domain\Repository\PageRepository\getRuntimeCache(), TYPO3\CMS\Core\Database\Connection\PARAM_INT, and TYPO3\CMS\Core\Domain\Repository\PageRepository\versionOL().

Referenced by TYPO3\CMS\Core\Domain\Repository\PageRepository\addMountPointParameterToPage(), TYPO3\CMS\Core\Domain\Repository\PageRepository\getDescendantPageIdsRecursive(), TYPO3\CMS\Core\Domain\Repository\PageRepository\getSubpagesRecursive(), and TYPO3\CMS\Core\Routing\PageRouter\resolveMountPointParameterIntoPageSlug().

◆ getMultipleGroupsWhereClause()

string TYPO3\CMS\Core\Domain\Repository\PageRepository::getMultipleGroupsWhereClause ( string  $field,
string  $table 
)

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

Parameters
string$field‪Field with group list
string$table‪Table name
Returns
‪string AND sql-clause
See also
getDefaultConstraints()

Definition at line 1585 of file PageRepository.php.

References TYPO3\CMS\Core\Domain\Repository\PageRepository\getRuntimeCache().

Referenced by TYPO3\CMS\Core\Domain\Repository\PageRepository\getDefaultConstraints(), and TYPO3\CMS\Core\Domain\Repository\PageRepository\init().

◆ getPage()

array TYPO3\CMS\Core\Domain\Repository\PageRepository::getPage ( int  $uid,
bool  $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 has constraints filled by the properties $this->where_groupAccess and $this->where_hid_del that are preset by the init() method.

See also
‪PageRepository::where_groupAccess
‪PageRepository::where_hid_del

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

The given Page ID can be preprocessed by registering an Event.

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

Definition at line 216 of file PageRepository.php.

References TYPO3\CMS\Webhooks\Message\$uid, TYPO3\CMS\Core\Domain\Repository\PageRepository\$where_groupAccess, TYPO3\CMS\Core\Domain\Repository\PageRepository\getLanguageOverlay(), TYPO3\CMS\Core\Domain\Repository\PageRepository\getRuntimeCache(), TYPO3\CMS\Core\Database\Connection\PARAM_INT, TYPO3\CMS\Core\Database\Query\QueryHelper\stripLogicalOperatorPrefix(), and TYPO3\CMS\Core\Domain\Repository\PageRepository\versionOL().

Referenced by TYPO3\CMS\Core\Domain\Repository\PageRepository\addMountPointParameterToPage(), TYPO3\CMS\Core\Domain\Repository\PageRepository\getPageShortcut(), and TYPO3\CMS\Core\Routing\PageRouter\resolveMountPointParameterIntoPageSlug().

◆ getPage_noCheck()

array TYPO3\CMS\Core\Domain\Repository\PageRepository::getPage_noCheck ( int  $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$uid‪The 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 285 of file PageRepository.php.

References TYPO3\CMS\Webhooks\Message\$uid, TYPO3\CMS\Core\Domain\Repository\PageRepository\getLanguageOverlay(), TYPO3\CMS\Core\Domain\Repository\PageRepository\getRuntimeCache(), TYPO3\CMS\Core\Database\Connection\PARAM_INT, and TYPO3\CMS\Core\Domain\Repository\PageRepository\versionOL().

◆ getPageIdsRecursive()

int [] TYPO3\CMS\Core\Domain\Repository\PageRepository::getPageIdsRecursive ( array  $pageIds,
int  $depth 
)

Perfect use case: get storage folders recursively, including the given Page IDs.

Difference to "getDescendantPageIdsRecursive" is that this is used with multiple Page IDs, AND it includes the page IDs themselves.

Returns
‪int[]

Definition at line 1836 of file PageRepository.php.

References TYPO3\CMS\Core\Domain\Repository\PageRepository\getDescendantPageIdsRecursive().

◆ getPageOverlay()

array TYPO3\CMS\Core\Domain\Repository\PageRepository::getPageOverlay ( int|array  $pageInput,
LanguageAspect|int  $language = null 
)

Returns the relevant page overlay record fields

Parameters
int | array$pageInput‪If $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 | LanguageAspect | null$language‪language UID if you want to set an alternative value to the given context which is default. Should be >=0
Exceptions

Definition at line 429 of file PageRepository.php.

References TYPO3\CMS\Core\Domain\Repository\PageRepository\getPagesOverlay().

Referenced by TYPO3\CMS\Core\Domain\Repository\PageRepository\getLanguageOverlay().

◆ getPageOverlaysForLanguage()

TYPO3\CMS\Core\Domain\Repository\PageRepository::getPageOverlaysForLanguage ( array  $pageUids,
LanguageAspect  $languageAspect 
)
protected

Returns the first match of overlays for pages in the passed languages.

NOTE regarding the query restrictions: Currently the visibility aspect within the FrontendRestrictionContainer will allow page translation records to be selected as they are child-records of a page. However, you may argue that the visibility flag should determine this. But that's not how it's done right now.

Parameters
LanguageAspect$languageAspect‪Used for the fallback chain

Definition at line 551 of file PageRepository.php.

References $GLOBALS, TYPO3\CMS\Core\Context\LanguageAspect\getId(), TYPO3\CMS\Core\Database\Platform\PlatformInformation\getMaxBindParameters(), TYPO3\CMS\Core\Domain\Repository\PageRepository\getRuntimeCache(), TYPO3\CMS\Core\Database\Connection\PARAM_INT_ARRAY, and TYPO3\CMS\Core\Domain\Repository\PageRepository\versionOL().

Referenced by TYPO3\CMS\Core\Domain\Repository\PageRepository\getPagesOverlay().

◆ getPageShortcut()

mixed TYPO3\CMS\Core\Domain\Repository\PageRepository::getPageShortcut (   $shortcutFieldValue,
  $shortcutMode,
  $thisUid,
  $iteration = 20,
  $pageLog = [],
  $disableGroupCheck = false,
bool  $resolveRandomPageShortcuts = true 
)
protected

Get page shortcut; Finds the records pointed to by input value $SC (the shortcut value)

Parameters
string$shortcutFieldValue‪The value of the "shortcut" field from the pages record
int$shortcutMode‪The shortcut mode: 1 will select first subpage, 2 a random subpage, 3 the parent page; default is the page pointed to by $SC
int$thisUid‪The current page UID of the page which is a shortcut
int$iteration‪Safety feature which makes sure that the function is calling itself recursively max 20 times (since this function can find shortcuts to other shortcuts to other shortcuts...)
array$pageLog‪An array filled with previous page uids tested by the function - new page uids are evaluated against this to avoid going in circles.
bool$disableGroupCheck‪If true, the group check is disabled when fetching the target page (needed e.g. for menu generation)
bool$resolveRandomPageShortcuts‪If true (default) this will also resolve shortcut to random subpages. In case of linking from a page to a shortcut page, we do not want to cache the "random" logic.
Exceptions

Definition at line 1049 of file PageRepository.php.

References TYPO3\CMS\Core\Domain\Repository\PageRepository\$where_groupAccess, TYPO3\CMS\Core\Domain\Repository\PageRepository\DOKTYPE_BE_USER_SECTION, TYPO3\CMS\Core\Domain\Repository\PageRepository\DOKTYPE_SPACER, TYPO3\CMS\Core\Domain\Repository\PageRepository\DOKTYPE_SYSFOLDER, TYPO3\CMS\Core\Domain\Repository\PageRepository\getMenu(), TYPO3\CMS\Core\Domain\Repository\PageRepository\getPage(), TYPO3\CMS\Core\Utility\GeneralUtility\intExplode(), TYPO3\CMS\Core\Domain\Repository\PageRepository\SHORTCUT_MODE_FIRST_SUBPAGE, TYPO3\CMS\Core\Domain\Repository\PageRepository\SHORTCUT_MODE_PARENT_PAGE, and TYPO3\CMS\Core\Domain\Repository\PageRepository\SHORTCUT_MODE_RANDOM_SUBPAGE.

Referenced by TYPO3\CMS\Core\Domain\Repository\PageRepository\resolveShortcutPage().

◆ getPagesOverlay()

array TYPO3\CMS\Core\Domain\Repository\PageRepository::getPagesOverlay ( array  $pagesInput,
int|LanguageAspect  $language = null 
)

Returns the relevant page overlay record fields

Parameters
array$pagesInput‪Array 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 | LanguageAspect | null$language‪Language UID if you want to set an alternative value to the given context aspect which is default. Should be >=0
Exceptions

Definition at line 447 of file PageRepository.php.

References TYPO3\CMS\Core\Domain\Repository\PageRepository\getPageOverlaysForLanguage().

Referenced by TYPO3\CMS\Core\Domain\Repository\PageRepository\getPageOverlay(), and TYPO3\CMS\Core\Domain\Repository\PageRepository\getSubpagesForPages().

◆ getRawRecord()

array null TYPO3\CMS\Core\Domain\Repository\PageRepository::getRawRecord ( string  $table,
int  $uid,
array  $fields = ['*'] 
)

Returns record no matter what - except if record is deleted

Parameters
string$table‪The table name to search
int$uid‪The uid to look up in $table
array$fields‪Fields to select, * is the default - If a custom list is set, make sure the list contains the uid field. It's mandatory for further processing of the result row.
Returns
‪array|null Returns array (the record) if found, otherwise null
See also
getPage_noCheck()

Definition at line 1385 of file PageRepository.php.

References $fields, $GLOBALS, TYPO3\CMS\Webhooks\Message\$uid, TYPO3\CMS\Core\Database\Connection\PARAM_INT, and TYPO3\CMS\Core\Domain\Repository\PageRepository\versionOL().

Referenced by TYPO3\CMS\Core\Domain\Repository\PageRepository\getDescendantPageIdsRecursive(), TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbBackend\overlayLanguageAndWorkspaceForJoinedSelect(), and TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbBackend\overlayLanguageAndWorkspaceForSingleRecord().

◆ getRecordOverlay()

array null TYPO3\CMS\Core\Domain\Repository\PageRepository::getRecordOverlay ( string  $table,
array  $row,
LanguageAspect  $languageAspect 
)
protected

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

The record receives a language overlay and a workspace overlay of the language overlay.

Parameters
string$table‪Table name
array$row‪Record to overlay. Must contain uid, pid and $table]['ctrl']['languageField']
Returns
‪array|null Returns the input record, possibly overlaid with a translation. But if overlays are not mixed ("fallback to default language") then it will return NULL if no translation is found.

Definition at line 634 of file PageRepository.php.

References $GLOBALS, TYPO3\CMS\Core\Context\LanguageAspect\getContentId(), TYPO3\CMS\Core\Context\LanguageAspect\getOverlayType(), TYPO3\CMS\Core\Domain\Repository\PageRepository\hasTableWorkspaceSupport(), TYPO3\CMS\Core\Context\LanguageAspect\OVERLAYS_OFF, TYPO3\CMS\Core\Context\LanguageAspect\OVERLAYS_ON, TYPO3\CMS\Core\Context\LanguageAspect\OVERLAYS_ON_WITH_FLOATING, TYPO3\CMS\Core\Database\Connection\PARAM_INT, and TYPO3\CMS\Core\Domain\Repository\PageRepository\versionOL().

Referenced by TYPO3\CMS\Core\Domain\Repository\PageRepository\getLanguageOverlay().

◆ getRuntimeCache()

◆ getSubpagesForPages()

array TYPO3\CMS\Core\Domain\Repository\PageRepository::getSubpagesForPages ( array  $pageIds,
string  $fields = '*',
string  $sortField = 'sorting',
string  $additionalWhereClause = '',
bool  $checkShortcuts = true,
bool  $parentPages = true,
bool  $disableGroupAccessCheck = false 
)
protected

Loads page records either by PIDs or by UIDs.

By default the subpages of the given page IDs are loaded (as the method name suggests). If $parentPages is set to FALSE, the page records for the given page IDs are loaded directly.

Concerning the rationale, please see these two other methods:

See also
PageRepository::getMenu()
PageRepository::getMenuForPages()

Version and language overlay are applied to the loaded records.

If a record is a mount point in overlay mode, the overlaying page record is returned in place of the record. The record is enriched by the field _MP_PARAM containing the mount point mapping for the mount point.

The query can be customized by setting fields, sorting and additional WHERE clauses. If additional WHERE clauses are given, the clause must start with an operator, i.e: "AND title like '%some text%'".

The keys of the returned page records are the page UIDs.

CAUTION: In case of an overlaid mount point, it is the original UID.

Parameters
int[]$pageIds‪PIDs or UIDs to load records for
string$fields‪Fields to select, * is the default - If a custom list is set, make sure the list contains the uid field. It's mandatory for further processing of the result row.
string$sortField‪the field to sort by
string$additionalWhereClause‪optional additional WHERE clause
bool$checkShortcuts‪whether to check if shortcuts exist
bool$parentPages‪Switch to load pages (false) or child pages (true).
Returns
‪array page records
See also
‪self::getPageShortcut()
‪\TYPO3\CMS\Frontend\ContentObject\Menu\AbstractMenuContentObject::makeMenu()

Definition at line 854 of file PageRepository.php.

References $fields, $GLOBALS, TYPO3\CMS\Core\Domain\Repository\PageRepository\$where_groupAccess, TYPO3\CMS\Core\Domain\Repository\PageRepository\addMountPointParameterToPage(), TYPO3\CMS\Core\Domain\Repository\PageRepository\checkValidShortcutOfPage(), TYPO3\CMS\Core\Domain\Repository\PageRepository\getPagesOverlay(), TYPO3\CMS\Core\Database\Connection\PARAM_INT, TYPO3\CMS\Core\Database\Connection\PARAM_INT_ARRAY, TYPO3\CMS\Core\Database\Query\QueryHelper\parseOrderBy(), TYPO3\CMS\Core\Database\Query\QueryHelper\stripLogicalOperatorPrefix(), TYPO3\CMS\Core\Utility\GeneralUtility\trimExplode(), and TYPO3\CMS\Core\Domain\Repository\PageRepository\versionOL().

Referenced by TYPO3\CMS\Core\Domain\Repository\PageRepository\getMenu(), and TYPO3\CMS\Core\Domain\Repository\PageRepository\getMenuForPages().

◆ getSubpagesRecursive()

int [] TYPO3\CMS\Core\Domain\Repository\PageRepository::getSubpagesRecursive ( int  $pageId,
int  $depth,
int  $begin,
array  $excludePageIds,
bool  $bypassEnableFieldsCheck,
array  $prevId_array = [] 
)
protected

This is an internal (recursive) method which returns the Page IDs for a given $pageId. and also checks for permissions of the pages AND resolves mountpoints.

Parameters
int$pageId‪must be a valid page record (this is not checked)
Returns
‪int[]

Definition at line 1906 of file PageRepository.php.

References TYPO3\CMS\Core\Domain\Repository\PageRepository\getMountPointInfo(), TYPO3\CMS\Core\Database\Connection\PARAM_INT, TYPO3\CMS\Core\Database\Connection\PARAM_INT_ARRAY, and TYPO3\CMS\Core\Domain\Repository\PageRepository\versionOL().

Referenced by TYPO3\CMS\Core\Domain\Repository\PageRepository\getDescendantPageIdsRecursive().

◆ getWorkspaceVersionOfRecord()

array int bool TYPO3\CMS\Core\Domain\Repository\PageRepository::getWorkspaceVersionOfRecord ( string  $table,
int  $uid,
array  $fields = ['*'],
bool  $bypassEnableFieldsCheck = false 
)

Select the version of a record for a workspace

Parameters
string$table‪Table name to select from
int$uid‪Record uid for which to find workspace version.
array$fields‪Fields to select, * is the default - If a custom list is set, make sure the list contains the uid field. It's mandatory for further processing of the result row.
bool$bypassEnableFieldsCheck‪If TRUE, enableFields are not checked for.
Returns
‪array|int|bool 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()

this is a rather low-level method, it is recommended to use versionOL instead()

Definition at line 1728 of file PageRepository.php.

References $fields, TYPO3\CMS\Webhooks\Message\$uid, TYPO3\CMS\Core\Domain\Repository\PageRepository\hasTableWorkspaceSupport(), and TYPO3\CMS\Core\Database\Connection\PARAM_INT.

Referenced by TYPO3\CMS\Core\Domain\Repository\PageRepository\checkIfPageIsHidden(), and TYPO3\CMS\Core\Domain\Repository\PageRepository\versionOL().

◆ hasTableWorkspaceSupport()

TYPO3\CMS\Core\Domain\Repository\PageRepository::hasTableWorkspaceSupport ( string  $tableName)
protected

◆ init()

TYPO3\CMS\Core\Domain\Repository\PageRepository::init ( )
protected

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.

Definition at line 133 of file PageRepository.php.

References TYPO3\CMS\Core\Domain\Repository\PageRepository\getDefaultConstraints(), TYPO3\CMS\Core\Domain\Repository\PageRepository\getMultipleGroupsWhereClause(), and TYPO3\CMS\Core\Domain\Repository\PageRepository\getRuntimeCache().

Referenced by TYPO3\CMS\Core\Domain\Repository\PageRepository\__construct().

◆ isPageSuitableForLanguage()

bool TYPO3\CMS\Core\Domain\Repository\PageRepository::isPageSuitableForLanguage ( array  $page,
LanguageAspect  $languageAspect 
)

Checks whether the passed (translated or default language) page is accessible with the given language settings.

Parameters
array$page‪the page translation record or the page in the default language
Returns
‪bool true if the given page translation record is suited for the given language ID

Definition at line 507 of file PageRepository.php.

References TYPO3\CMS\Core\Context\LanguageAspect\getId(), and TYPO3\CMS\Core\Domain\Repository\PageRepository\getLanguageFallbackChain().

◆ purgeComputedProperties()

TYPO3\CMS\Core\Domain\Repository\PageRepository::purgeComputedProperties ( array  $row)
protected

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

Definition at line 2110 of file PageRepository.php.

Referenced by TYPO3\CMS\Core\Domain\Repository\PageRepository\versionOL().

◆ resolveShortcutPage()

TYPO3\CMS\Core\Domain\Repository\PageRepository::resolveShortcutPage ( array  $page,
bool  $resolveRandomSubpages = false,
bool  $disableGroupAccessCheck = false 
)

Check if page is a shortcut, then resolve the target page directly. This is a better method than "getPageShortcut()" and should be used instead, as this automatically checks for $page records and returns the shortcut pages directly.

This method also provides a runtime cache around resolving the shortcut resolving, in order to speed up link generation to the same shortcut page.

Exceptions
ShortcutTargetPageNotFoundException

Definition at line 1134 of file PageRepository.php.

References TYPO3\CMS\Core\Domain\Repository\PageRepository\getPageShortcut(), and TYPO3\CMS\Core\Domain\Repository\PageRepository\getRuntimeCache().

Referenced by TYPO3\CMS\Frontend\Typolink\PageLinkBuilder\resolveShortcutPage().

◆ versionOL()

TYPO3\CMS\Core\Domain\Repository\PageRepository::versionOL ( string  $table,
$row,
bool  $unsetMovePointers = false,
bool  $bypassEnableFieldsCheck = false 
)

Versioning Preview Overlay

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

Generally ALWAYS used when records are selected based on uid or pid. If records are selected on other fields than uid or pid (eg. "email = ....") then usage might produce undesired results and that should be evaluated on individual basis.

Principle: Record online! => Find offline?

Parameters
string$table‪Table name
array$row‪Record array passed by reference. As minimum, the "uid", "pid" and "t3ver_state" fields must exist! The record MAY be set to FALSE in which case the calling function should act as if the record is forbidden to access!
bool$unsetMovePointers‪If set, the $row is cleared in case it is a move-pointer. This is only for preview of moved records (to remove the record from the original location so it appears only in the new location)
bool$bypassEnableFieldsCheck‪Unless this option is TRUE, the $row is unset if enablefields for BOTH the version AND the online record deselects it. This is because when versionOL() is called it is assumed that the online record is already selected with no regards to it's enablefields. However, after looking for a new version the online record enablefields must ALSO be evaluated of course. This is done all by this function!
See also
‪BackendUtility::workspaceOL()

Definition at line 1644 of file PageRepository.php.

References $fields, TYPO3\CMS\Core\Domain\Repository\PageRepository\getWorkspaceVersionOfRecord(), TYPO3\CMS\Core\Versioning\indicatesPlaceholder, TYPO3\CMS\Core\Database\Connection\PARAM_INT, and TYPO3\CMS\Core\Domain\Repository\PageRepository\purgeComputedProperties().

Referenced by TYPO3\CMS\Core\Domain\Repository\PageRepository\checkRecord(), TYPO3\CMS\Core\Domain\Repository\PageRepository\getMountPointInfo(), TYPO3\CMS\Core\Domain\Repository\PageRepository\getPage(), TYPO3\CMS\Core\Domain\Repository\PageRepository\getPage_noCheck(), TYPO3\CMS\Core\Domain\Repository\PageRepository\getPageOverlaysForLanguage(), TYPO3\CMS\Core\Domain\Repository\PageRepository\getRawRecord(), TYPO3\CMS\Core\Domain\Repository\PageRepository\getRecordOverlay(), TYPO3\CMS\Core\Domain\Repository\PageRepository\getSubpagesForPages(), TYPO3\CMS\Core\Domain\Repository\PageRepository\getSubpagesRecursive(), and TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbBackend\overlayLanguageAndWorkspaceForSingleRecord().

Member Data Documentation

◆ $computedPropertyNames

array TYPO3\CMS\Core\Domain\Repository\PageRepository::$computedPropertyNames
protected
Initial value:
= [
'_LOCALIZED_UID',
'_REQUESTED_OVERLAY_LANGUAGE',
'_MP_PARAM',
'_ORIG_uid',
'_ORIG_pid',
'_SHORTCUT_ORIGINAL_PAGE_UID',
]

Computed properties that are added to database rows.

Definition at line 86 of file PageRepository.php.

◆ $context

Context TYPO3\CMS\Core\Domain\Repository\PageRepository::$context
protected

◆ $where_groupAccess

string TYPO3\CMS\Core\Domain\Repository\PageRepository::$where_groupAccess = ''
protected

◆ $where_hid_del

string TYPO3\CMS\Core\Domain\Repository\PageRepository::$where_hid_del = 'pages.deleted=0'
protected

This is not the final clauses. There will normally be conditions for the hidden, starttime and endtime fields as well. This is initialized in the init() function.

Definition at line 76 of file PageRepository.php.

◆ DOKTYPE_BE_USER_SECTION

◆ DOKTYPE_DEFAULT

◆ DOKTYPE_LINK

◆ DOKTYPE_MOUNTPOINT

◆ DOKTYPE_SHORTCUT

◆ DOKTYPE_SPACER

◆ DOKTYPE_SYSFOLDER

◆ SHORTCUT_MODE_FIRST_SUBPAGE

const TYPO3\CMS\Core\Domain\Repository\PageRepository::SHORTCUT_MODE_FIRST_SUBPAGE = 1

◆ SHORTCUT_MODE_NONE

const TYPO3\CMS\Core\Domain\Repository\PageRepository::SHORTCUT_MODE_NONE = 0

Named constants for "magic numbers" of the field shortcut_mode

Definition at line 109 of file PageRepository.php.

Referenced by TYPO3\CMS\Backend\Controller\PageLayoutController\generateMessagesForCurrentPage().

◆ SHORTCUT_MODE_PARENT_PAGE

const TYPO3\CMS\Core\Domain\Repository\PageRepository::SHORTCUT_MODE_PARENT_PAGE = 3

◆ SHORTCUT_MODE_RANDOM_SUBPAGE

const TYPO3\CMS\Core\Domain\Repository\PageRepository::SHORTCUT_MODE_RANDOM_SUBPAGE = 2