PageRepository implements LoggerAwareInterface uses LoggerAwareTrait, PublicMethodDeprecationTrait, PublicPropertyDeprecationTrait
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
Tags
Table of Contents
Interfaces
- LoggerAwareInterface
Constants
- DOKTYPE_BE_USER_SECTION = 6
- DOKTYPE_DEFAULT = 1
- Named constants for "magic numbers" of the field doktype
- DOKTYPE_LINK = 3
- DOKTYPE_MOUNTPOINT = 7
- DOKTYPE_RECYCLER = 255
- DOKTYPE_SHORTCUT = 4
- DOKTYPE_SPACER = 199
- DOKTYPE_SYSFOLDER = 254
- SHORTCUT_MODE_FIRST_SUBPAGE = 1
- SHORTCUT_MODE_NONE = 0
- Named constants for "magic numbers" of the field shortcut_mode
- SHORTCUT_MODE_PARENT_PAGE = 3
- SHORTCUT_MODE_RANDOM_SUBPAGE = 2
Properties
- $computedPropertyNames : array<string|int, mixed>
- Computed properties that are added to database rows.
- $context : Context
- $sys_language_uid : int
- Can be migrated away later to use context API directly.
- $versioningWorkspaceId : int
- Can be migrated away later to use context API directly.
- $where_groupAccess : string
- Clause for fe_group access
- $where_hid_del : string
- This is not the final clauses. There will normally be conditions for the hidden, starttime and endtime fields as well. You MUST initialize the object by the init() function
Methods
- __call() : mixed
- Checks if the method of the given name is available, calls it but throws a deprecation.
- __construct() : mixed
- PageRepository constructor to set the base context, this will effectively remove the necessity for setting properties from the outside.
- __get() : mixed
- Gets the value of the property of the given name if tagged.
- __isset() : bool
- Checks if the property of the given name is set.
- __set() : mixed
- Sets the property of the given name if tagged.
- __unset() : mixed
- Unsets the property of the given name if tagged.
- checkIfPageIsHidden() : bool
- Checks if the page is hidden in the active workspace (and the current language), then the "preview" mode for frontend pages is active.
- checkRecord() : array<string|int, mixed>|int
- Checks if a record exists and is accessible.
- enableFields() : string
- 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.
- filterAccessiblePageIds() : array<string|int, int>
- 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
- getDescendantPageIdsRecursive() : array<string|int, int>
- Generates a list of Page IDs from $startPageId. List does not include $startPageId itself.
- getExtURL() : string|bool
- Returns the redirect URL for the input page row IF the doktype is set to 3.
- getLanguageOverlay() : array<string|int, mixed>|null
- Master helper method to overlay a record to a language.
- getMenu() : array<string|int, mixed>
- Returns an array with page rows for subpages of a certain page ID. This is used for menus in the frontend.
- getMenuForPages() : array<string|int, mixed>
- Returns an array with page-rows for pages with uid in $pageIds.
- getMountPointInfo() : mixed
- Returns a MountPoint array for the specified page
- getMultipleGroupsWhereClause() : string
- Creating where-clause for checking group access to elements in enableFields function
- getPage() : array<string|int, mixed>
- Loads the full page record for the given page ID.
- getPage_noCheck() : array<string|int, mixed>
- Return the $row for the page with uid = $uid WITHOUT checking for ->where_hid_del (start- and endtime or hidden). Only "deleted" is checked!
- getPageIdsRecursive() : array<string|int, int>
- Perfect use case: get storage folders recursively, including the given Page IDs.
- getPageOverlay() : array<string|int, mixed>
- Returns the relevant page overlay record fields
- getPageShortcut() : mixed
- Get page shortcut; Finds the records pointed to by input value $SC (the shortcut value)
- getPagesOverlay() : array<string|int, mixed>
- Returns the relevant page overlay record fields
- getRawRecord() : mixed
- Returns record no matter what - except if record is deleted
- getWorkspaceVersionOfRecord() : mixed
- Select the version of a record for a workspace
- isPageSuitableForLanguage() : bool
- Checks whether the passed (translated or default language) page is accessible with the given language settings.
- resolveShortcutPage() : array<string|int, mixed>
- Check if page is a shortcut, then resolve the target page directly.
- versionOL() : mixed
- Versioning Preview Overlay
- addMountPointParameterToPage() : array<string|int, mixed>
- Replaces the given page record with mounted page if required
- checkValidShortcutOfPage() : array<string|int, mixed>
- If shortcut, look up if the target exists and is currently visible
- getLanguageFallbackChain() : array<string|int, int>
- Returns the cleaned fallback chain from the current language aspect, if there is one.
- getPageOverlaysForLanguage() : array<string|int, mixed>
- Returns the first match of overlays for pages in the passed languages.
- getRecordOverlay() : array<string|int, mixed>|null
- Creates language-overlay for records in general (where translation is found in records from the same table)
- getRuntimeCache() : VariableFrontend
- getSubpagesForPages() : array<string|int, mixed>
- Loads page records either by PIDs or by UIDs.
- getSubpagesRecursive() : array<string|int, int>
- This is an internal (recursive) method which returns the Page IDs for a given $pageId.
- hasTableWorkspaceSupport() : bool
- init() : mixed
- 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
- purgeComputedProperties() : array<string|int, mixed>
- Purges computed properties from database rows, such as _ORIG_uid or _ORIG_pid for instance.
Constants
DOKTYPE_BE_USER_SECTION
public
mixed
DOKTYPE_BE_USER_SECTION
= 6
DOKTYPE_DEFAULT
Named constants for "magic numbers" of the field doktype
public
mixed
DOKTYPE_DEFAULT
= 1
DOKTYPE_LINK
public
mixed
DOKTYPE_LINK
= 3
DOKTYPE_MOUNTPOINT
public
mixed
DOKTYPE_MOUNTPOINT
= 7
DOKTYPE_RECYCLER
public
mixed
DOKTYPE_RECYCLER
= 255
DOKTYPE_SHORTCUT
public
mixed
DOKTYPE_SHORTCUT
= 4
DOKTYPE_SPACER
public
mixed
DOKTYPE_SPACER
= 199
DOKTYPE_SYSFOLDER
public
mixed
DOKTYPE_SYSFOLDER
= 254
SHORTCUT_MODE_FIRST_SUBPAGE
public
mixed
SHORTCUT_MODE_FIRST_SUBPAGE
= 1
SHORTCUT_MODE_NONE
Named constants for "magic numbers" of the field shortcut_mode
public
mixed
SHORTCUT_MODE_NONE
= 0
SHORTCUT_MODE_PARENT_PAGE
public
mixed
SHORTCUT_MODE_PARENT_PAGE
= 3
SHORTCUT_MODE_RANDOM_SUBPAGE
public
mixed
SHORTCUT_MODE_RANDOM_SUBPAGE
= 2
Properties
$computedPropertyNames
Computed properties that are added to database rows.
protected
array<string|int, mixed>
$computedPropertyNames
= ['_LOCALIZED_UID', '_MP_PARAM', '_ORIG_uid', '_ORIG_pid', '_SHORTCUT_ORIGINAL_PAGE_UID', '_PAGES_OVERLAY', '_PAGES_OVERLAY_UID', '_PAGES_OVERLAY_LANGUAGE', '_PAGES_OVERLAY_REQUESTEDLANGUAGE']
$context
protected
Context
$context
$sys_language_uid
Can be migrated away later to use context API directly.
protected
int
$sys_language_uid
= 0
$versioningWorkspaceId
Can be migrated away later to use context API directly.
protected
int
$versioningWorkspaceId
= 0
Workspace ID for preview If > 0, versioning preview of other record versions is allowed. THIS MUST ONLY BE SET IF the page is not cached and truly previewed by a backend user!
$where_groupAccess
Clause for fe_group access
protected
string
$where_groupAccess
= ''
$where_hid_del
This is not the final clauses. There will normally be conditions for the hidden, starttime and endtime fields as well. You MUST initialize the object by the init() function
protected
string
$where_hid_del
= ' AND pages.deleted=0'
Methods
__call()
Checks if the method of the given name is available, calls it but throws a deprecation.
public
__call(string $methodName, array<string|int, mixed> $arguments) : mixed
If the method does not exist, a fatal error is thrown.
Unavailable protected methods must return in a fatal error as usual. Marked methods are called and a deprecation entry is thrown.
__call() is not called for public methods.
Parameters
- $methodName : string
- $arguments : array<string|int, mixed>
__construct()
PageRepository constructor to set the base context, this will effectively remove the necessity for setting properties from the outside.
public
__construct([Context|null $context = null ]) : mixed
Parameters
- $context : Context|null = null
__get()
Gets the value of the property of the given name if tagged.
public
__get(string $propertyName) : mixed
The evaluation is done in the assumption that this method is never reached for a public property.
Parameters
- $propertyName : string
__isset()
Checks if the property of the given name is set.
public
__isset(string $propertyName) : bool
Unmarked protected properties must return false as usual. Marked properties are evaluated by isset().
This method is not called for public properties.
Parameters
- $propertyName : string
Return values
bool__set()
Sets the property of the given name if tagged.
public
__set(string $propertyName, mixed $propertyValue) : mixed
Additionally it's allowed to set unknown properties.
The evaluation is done in the assumption that this method is never reached for a public property.
Parameters
- $propertyName : string
- $propertyValue : mixed
__unset()
Unsets the property of the given name if tagged.
public
__unset(string $propertyName) : mixed
Parameters
- $propertyName : string
checkIfPageIsHidden()
Checks if the page is hidden in the active workspace (and the current language), then the "preview" mode for frontend pages is active.
public
checkIfPageIsHidden(int $pageId, LanguageAspect $languageAspect) : bool
Parameters
- $pageId : int
- $languageAspect : LanguageAspect
this is not part of the TYPO3 Core API.
Return values
boolcheckRecord()
Checks if a record exists and is accessible.
public
checkRecord(string $table, int $uid[, bool|int $checkPage = 0 ]) : array<string|int, mixed>|int
The row is returned if everything's OK.
Parameters
- $table : string
-
The table name to search
- $uid : int
-
The uid to look up in $table
- $checkPage : bool|int = 0
-
If checkPage is set, it's also required that the page on which the record resides is accessible
Return values
array<string|int, mixed>|int —Returns array (the record) if OK, otherwise blank/0 (zero)
enableFields()
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.
public
enableFields(string $table[, int $show_hidden = -1 ][, array<string|int, mixed> $ignore_array = [] ]) : string
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
- $table : string
-
Table name found in the $GLOBALS['TCA'] array
- $show_hidden : int = -1
-
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.
- $ignore_array : array<string|int, mixed> = []
-
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.
Tags
Return values
string —The clause starting like " AND ...=... AND ...=...
filterAccessiblePageIds()
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
public
filterAccessiblePageIds(array<string|int, int> $pageIds[, QueryRestrictionContainerInterface|null $restrictionContainer = null ]) : array<string|int, int>
Parameters
- $pageIds : array<string|int, int>
-
Array of Page UID numbers to check
- $restrictionContainer : QueryRestrictionContainerInterface|null = null
Return values
array<string|int, int> —Returns the array of remaining page UID numbers
getDescendantPageIdsRecursive()
Generates a list of Page IDs from $startPageId. List does not include $startPageId itself.
public
getDescendantPageIdsRecursive(int $startPageId, int $depth[, int $begin = 0 ][, array<string|int, mixed> $excludePageIds = [] ][, bool $bypassEnableFieldsCheck = false ]) : array<string|int, int>
Only works on default language level.
Pages that prevent looking for further subpages:
- deleted pages
- pages of the Backend User Section (doktype = 6) and recycler (doktype = 255) 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
- $startPageId : int
-
The id of the start page from which point in the page tree to descend.
- $depth : int
-
Maximum recursion depth. Use 100 or so to descend "infinitely". Stops when 0 is reached.
- $begin : int = 0
-
An optional integer the level in the tree to start collecting. Zero means 'start right away', 1 = 'next level and out'
- $excludePageIds : array<string|int, mixed> = []
-
Avoid collecting these pages and their possible subpages
- $bypassEnableFieldsCheck : bool = false
-
If true, then enableFields and other checks are not evaluated
Return values
array<string|int, int> —Returns the list of Page IDs
getExtURL()
Returns the redirect URL for the input page row IF the doktype is set to 3.
public
getExtURL(array<string|int, mixed> $pagerow) : string|bool
since TYPO3 v12, will be removed in TYPO3 v13.0
Parameters
- $pagerow : array<string|int, mixed>
-
The page row to return URL type for
Return values
string|bool —The URL from based on the data from "pages:url". False if not found.
getLanguageOverlay()
Master helper method to overlay a record to a language.
public
getLanguageOverlay(string $table, array<string|int, mixed> $originalRow[, LanguageAspect|null $languageAspect = null ]) : array<string|int, mixed>|null
Be aware that for pages the languageId is taken, and for all other records the contentId of the Aspect is used.
Parameters
- $table : string
-
the name of the table, should be a TCA table with localization enabled
- $originalRow : array<string|int, mixed>
-
the current (full-fletched) record.
- $languageAspect : LanguageAspect|null = null
-
an alternative language aspect if needed (optional)
Return values
array<string|int, mixed>|null —NULL If overlays were activated but no overlay was found and LanguageAspect was NOT set to MIXED
getMenu()
Returns an array with page rows for subpages of a certain page ID. This is used for menus in the frontend.
public
getMenu(int|array<string|int, int> $pageId[, string $fields = '*' ][, string $sortField = 'sorting' ][, string $additionalWhereClause = '' ][, bool $checkShortcuts = true ][, bool $disableGroupAccessCheck = false ]) : array<string|int, mixed>
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
- $pageId : int|array<string|int, int>
-
The page id (or array of page ids) for which to fetch subpages (PID)
- $fields : string = '*'
-
Fields to select,
*
is the default - If a custom list is set, make sure the list contains theuid
field. It's mandatory for further processing of the result row. - $sortField : string = 'sorting'
-
The field to sort by. Default is "sorting
- $additionalWhereClause : string = ''
-
Optional additional where clauses. Like "AND title like '%some text%'" for instance.
- $checkShortcuts : bool = true
-
Check if shortcuts exist, checks by default
- $disableGroupAccessCheck : bool = false
Tags
Return values
array<string|int, mixed> —Array with key/value pairs; keys are page-uid numbers. values are the corresponding page records (with overlaid localized fields, if any)
getMenuForPages()
Returns an array with page-rows for pages with uid in $pageIds.
public
getMenuForPages(array<string|int, int> $pageIds[, string $fields = '*' ][, string $sortField = 'sorting' ][, string $additionalWhereClause = '' ][, bool $checkShortcuts = true ][, bool $disableGroupAccessCheck = false ]) : array<string|int, mixed>
This is used for menus. If there are mount points in overlay mode the _MP_PARAM field is set to the correct MPvar.
Parameters
- $pageIds : array<string|int, int>
-
Array of page ids to fetch
- $fields : string = '*'
-
Fields to select,
*
is the default - If a custom list is set, make sure the list contains theuid
field. It's mandatory for further processing of the result row. - $sortField : string = 'sorting'
-
The field to sort by. Default is "sorting"
- $additionalWhereClause : string = ''
-
Optional additional where clauses. Like "AND title like '%some text%'" for instance.
- $checkShortcuts : bool = true
-
Check if shortcuts exist, checks by default
- $disableGroupAccessCheck : bool = false
Return values
array<string|int, mixed> —Array with key/value pairs; keys are page-uid numbers. values are the corresponding page records (with overlaid localized fields, if any)
getMountPointInfo()
Returns a MountPoint array for the specified page
public
getMountPointInfo(int $pageId[, array<string|int, mixed>|bool $pageRec = false ][, array<string|int, mixed> $prevMountPids = [] ][, int $firstPageUid = 0 ]) : mixed
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.
Parameters
- $pageId : int
-
Page id to do the lookup for.
- $pageRec : array<string|int, mixed>|bool = false
-
Optional page record for the given page.
- $prevMountPids : array<string|int, mixed> = []
-
Internal register to prevent lookup cycles.
- $firstPageUid : int = 0
-
The first page id.
Tags
Return values
mixed —Mount point array or failure flags (-1, false).
getMultipleGroupsWhereClause()
Creating where-clause for checking group access to elements in enableFields function
public
getMultipleGroupsWhereClause(string $field, string $table) : string
Parameters
- $field : string
-
Field with group list
- $table : string
-
Table name
Tags
Return values
string —AND sql-clause
getPage()
Loads the full page record for the given page ID.
public
getPage(int $uid[, bool $disableGroupAccessCheck = false ]) : array<string|int, mixed>
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.
Parameters
- $uid : int
-
The page id to look up
- $disableGroupAccessCheck : bool = false
-
set to true to disable group access check
Tags
Return values
array<string|int, mixed> —The resulting page record with overlays or empty array
getPage_noCheck()
Return the $row for the page with uid = $uid WITHOUT checking for ->where_hid_del (start- and endtime or hidden). Only "deleted" is checked!
public
getPage_noCheck(int $uid) : array<string|int, mixed>
Parameters
- $uid : int
-
The page id to look up
Tags
Return values
array<string|int, mixed> —The page row with overlaid localized fields. Empty array if no page.
getPageIdsRecursive()
Perfect use case: get storage folders recursively, including the given Page IDs.
public
getPageIdsRecursive(array<string|int, mixed> $pageIds, int $depth) : array<string|int, int>
Difference to "getDescendantPageIdsRecursive" is that this is used with multiple Page IDs, AND it includes the page IDs themselves.
Parameters
- $pageIds : array<string|int, mixed>
- $depth : int
Return values
array<string|int, int>getPageOverlay()
Returns the relevant page overlay record fields
public
getPageOverlay(mixed $pageInput[, int|LanguageAspect|null $language = null ]) : array<string|int, mixed>
Parameters
- $pageInput : mixed
-
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.
- $language : int|LanguageAspect|null = null
-
language UID if you want to set an alternative value to $this->sys_language_uid which is default. Should be >=0
Tags
Return values
array<string|int, mixed> —Page row which is overlaid with language_overlay record (or the overlay record alone)
getPageShortcut()
Get page shortcut; Finds the records pointed to by input value $SC (the shortcut value)
public
getPageShortcut(string $shortcutFieldValue, int $shortcutMode, int $thisUid[, int $iteration = 20 ][, array<string|int, mixed> $pageLog = [] ][, bool $disableGroupCheck = false ][, bool $resolveRandomPageShortcuts = true ]) : mixed
Parameters
- $shortcutFieldValue : string
-
The value of the "shortcut" field from the pages record
- $shortcutMode : int
-
The shortcut mode: 1 will select first subpage, 2 a random subpage, 3 the parent page; default is the page pointed to by $SC
- $thisUid : int
-
The current page UID of the page which is a shortcut
- $iteration : int = 20
-
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...)
- $pageLog : array<string|int, mixed> = []
-
An array filled with previous page uids tested by the function - new page uids are evaluated against this to avoid going in circles.
- $disableGroupCheck : bool = false
-
If true, the group check is disabled when fetching the target page (needed e.g. for menu generation)
- $resolveRandomPageShortcuts : bool = true
-
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.
Tags
Return values
mixed —Returns the page record of the page that the shortcut pointed to. If $resolveRandomPageShortcuts = false, and the shortcut page is configured to point to a random shortcut then an empty array is returned
getPagesOverlay()
Returns the relevant page overlay record fields
public
getPagesOverlay(array<string|int, mixed> $pagesInput[, int|LanguageAspect|null $language = null ]) : array<string|int, mixed>
Parameters
- $pagesInput : array<string|int, mixed>
-
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.
- $language : int|LanguageAspect|null = null
-
Language UID if you want to set an alternative value to $this->sys_language_uid which is default. Should be >=0
Tags
Return values
array<string|int, mixed> —Page rows which are overlaid with language_overlay record. If the input was an array of integers, missing records are not included. If the input were page rows, untranslated pages are returned.
getRawRecord()
Returns record no matter what - except if record is deleted
public
getRawRecord(string $table, int $uid[, string $fields = '*' ]) : mixed
Parameters
- $table : string
-
The table name to search
- $uid : int
-
The uid to look up in $table
- $fields : string = '*'
-
Fields to select,
*
is the default - If a custom list is set, make sure the list contains theuid
field. It's mandatory for further processing of the result row.
Tags
Return values
mixed —Returns array (the record) if found, otherwise blank/0 (zero)
getWorkspaceVersionOfRecord()
Select the version of a record for a workspace
public
getWorkspaceVersionOfRecord(int $workspace, string $table, int $uid[, string $fields = '*' ][, bool $bypassEnableFieldsCheck = false ]) : mixed
Parameters
- $workspace : int
-
Workspace ID
- $table : string
-
Table name to select from
- $uid : int
-
Record uid for which to find workspace version.
- $fields : string = '*'
-
Fields to select,
*
is the default - If a custom list is set, make sure the list contains theuid
field. It's mandatory for further processing of the result row. - $bypassEnableFieldsCheck : bool = false
-
If TRUE, enablefields are not checked for.
this is a rather low-level method, it is recommended to use versionOL instead()
Tags
Return values
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.
isPageSuitableForLanguage()
Checks whether the passed (translated or default language) page is accessible with the given language settings.
public
isPageSuitableForLanguage(array<string|int, mixed> $page, LanguageAspect $languageAspect) : bool
Parameters
- $page : array<string|int, mixed>
-
the page translation record or the page in the default language
- $languageAspect : LanguageAspect
Return values
bool —true if the given page translation record is suited for the given language ID
resolveShortcutPage()
Check if page is a shortcut, then resolve the target page directly.
public
resolveShortcutPage(array<string|int, mixed> $page[, bool $resolveRandomSubpages = false ][, bool $disableGroupAccessCheck = false ]) : array<string|int, mixed>
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.
Parameters
- $page : array<string|int, mixed>
- $resolveRandomSubpages : bool = false
- $disableGroupAccessCheck : bool = false
Tags
Return values
array<string|int, mixed>versionOL()
Versioning Preview Overlay
public
versionOL(string $table, array<string|int, mixed> &$row[, bool $unsetMovePointers = false ][, bool $bypassEnableFieldsCheck = false ]) : mixed
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
- $table : string
-
Table name
- $row : array<string|int, mixed>
-
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!
- $unsetMovePointers : bool = false
-
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)
- $bypassEnableFieldsCheck : bool = false
-
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!
Tags
addMountPointParameterToPage()
Replaces the given page record with mounted page if required
protected
addMountPointParameterToPage(array<string|int, mixed> $page) : array<string|int, mixed>
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.
Parameters
- $page : array<string|int, mixed>
-
The page record to handle.
Tags
Return values
array<string|int, mixed> —The given page record or it's replacement.
checkValidShortcutOfPage()
If shortcut, look up if the target exists and is currently visible
protected
checkValidShortcutOfPage(array<string|int, mixed> $page, string $additionalWhereClause) : array<string|int, mixed>
Parameters
- $page : array<string|int, mixed>
-
The page to check
- $additionalWhereClause : string
-
Optional additional where clauses. Like "AND title like '%some text%'" for instance.
Return values
array<string|int, mixed>getLanguageFallbackChain()
Returns the cleaned fallback chain from the current language aspect, if there is one.
protected
getLanguageFallbackChain(LanguageAspect|null $languageAspect) : array<string|int, int>
Parameters
- $languageAspect : LanguageAspect|null
Return values
array<string|int, int>getPageOverlaysForLanguage()
Returns the first match of overlays for pages in the passed languages.
protected
getPageOverlaysForLanguage(array<string|int, mixed> $pageUids, LanguageAspect $languageAspect) : array<string|int, mixed>
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
- $pageUids : array<string|int, mixed>
- $languageAspect : LanguageAspect
-
Used for the fallback chain
Return values
array<string|int, mixed>getRecordOverlay()
Creates language-overlay for records in general (where translation is found in records from the same table)
protected
getRecordOverlay(string $table, array<string|int, mixed> $row[, LanguageAspect|int|null $languageAspect = null ][, string $OLmode = '' ]) : array<string|int, mixed>|null
Parameters
- $table : string
-
Table name
- $row : array<string|int, mixed>
-
Record to overlay. Must contain uid, pid and $table]['ctrl']['languageField']
- $languageAspect : LanguageAspect|int|null = null
-
Pointer to the site language id for content on the site.
- $OLmode : string = ''
-
Overlay mode. If "hideNonTranslated" then records without translation will not be returned un-translated but unset (and return value is NULL) - will be removed in TYPOO3 v13.0.
Tags
Return values
array<string|int, mixed>|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.
getRuntimeCache()
protected
getRuntimeCache() : VariableFrontend
Return values
VariableFrontendgetSubpagesForPages()
Loads page records either by PIDs or by UIDs.
protected
getSubpagesForPages(array<string|int, int> $pageIds[, string $fields = '*' ][, string $sortField = 'sorting' ][, string $additionalWhereClause = '' ][, bool $checkShortcuts = true ][, bool $parentPages = true ][, bool $disableGroupAccessCheck = false ]) : array<string|int, mixed>
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:
Parameters
- $pageIds : array<string|int, int>
-
PIDs or UIDs to load records for
- $fields : string = '*'
-
Fields to select,
*
is the default - If a custom list is set, make sure the list contains theuid
field. It's mandatory for further processing of the result row. - $sortField : string = 'sorting'
-
the field to sort by
- $additionalWhereClause : string = ''
-
optional additional WHERE clause
- $checkShortcuts : bool = true
-
whether to check if shortcuts exist
- $parentPages : bool = true
-
Switch to load pages (false) or child pages (true).
- $disableGroupAccessCheck : bool = false
Tags
Return values
array<string|int, mixed> —page records
getSubpagesRecursive()
This is an internal (recursive) method which returns the Page IDs for a given $pageId.
protected
getSubpagesRecursive(int $pageId, int $depth, int $begin, array<string|int, mixed> $excludePageIds, bool $bypassEnableFieldsCheck[, array<string|int, mixed> $prevId_array = [] ]) : array<string|int, int>
and also checks for permissions of the pages AND resolves mountpoints.
Parameters
- $pageId : int
-
must be a valid page record (this is not checked)
- $depth : int
- $begin : int
- $excludePageIds : array<string|int, mixed>
- $bypassEnableFieldsCheck : bool
- $prevId_array : array<string|int, mixed> = []
Return values
array<string|int, int>hasTableWorkspaceSupport()
protected
hasTableWorkspaceSupport(string $tableName) : bool
Parameters
- $tableName : string
Return values
boolinit()
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
protected
init(bool $show_hidden) : mixed
Parameters
- $show_hidden : bool
-
If $show_hidden is TRUE, the hidden-field is ignored!! Normally this should be FALSE. Is used for previewing.
purgeComputedProperties()
Purges computed properties from database rows, such as _ORIG_uid or _ORIG_pid for instance.
protected
purgeComputedProperties(array<string|int, mixed> $row) : array<string|int, mixed>
Parameters
- $row : array<string|int, mixed>