BackendUtility
Standard functions available for the TYPO3 backend.
You are encouraged to use this class in your own applications (Backend Modules) Don't instantiate - call functions with "\TYPO3\CMS\Backend\Utility\BackendUtility::" prefixed the function name.
Call ALL methods without making an object! Eg. to get a page-record 51 do this: '\TYPO3\CMS\Backend\Utility\BackendUtility::getRecord('pages',51)'
Table of Contents
Methods
- ADMCMD_previewCmds() : string
- Creates ADMCMD parameters for the "viewpage" extension / frontend
- BEenableFields() : string
- Backend implementation of enableFields() Notice that "fe_groups" is not selected for - only disabled, starttime and endtime.
- BEgetRootLine() : array<string|int, mixed>
- Returns what is called the 'RootLine'. That is an array with information about the page records from a page id ($uid) and back to the root.
- calcAge() : string
- Returns the "age" in minutes / hours / days / years of the number of $seconds inputted.
- cshItem() : string
- API for getting CSH icons/text for use in backend modules.
- date() : string
- Returns $tstamp formatted as "ddmmyy" (According to $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'])
- datetime() : string
- Returns $tstamp formatted as "ddmmyy hhmm" (According to $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'] AND $GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'])
- dateTimeAge() : string
- Returns a formatted timestamp if $tstamp is set.
- daysUntil() : int
- Returns the difference in days between input $tstamp and $EXEC_TIME
- explodeSoftRefParserList() : array<string|int, mixed>|bool
- Returns array of soft parser references
- fixVersioningPid() : mixed
- Find page-tree PID for versionized record Used whenever you are tracking something back, like making the root line.
- getAllowedFieldsForTable() : array<string|int, string>
- Get all fields of a table, which are allowed for the current user
- getClickMenuOnIconTagParameters() : array<string|int, mixed>
- getCommonSelectFields() : string
- Returns fields for a table, $table, which would typically be interesting to select This includes uid, the fields defined for title, icon-field.
- getDropdownMenu() : string
- Returns a selector box to switch the view Based on BackendUtility::getFuncMenu() but done as new function because it has another purpose.
- getFuncCheck() : string
- Checkbox function menu.
- getFuncInput() : string
- Input field function menu Works like ->getFuncMenu() / ->getFuncCheck() but displays an input field instead which updates the script "onchange"
- getFuncMenu() : string
- Returns a selector box "function menu" for a module
- getGroupNames() : array<string|int, mixed>
- Returns an array with be_groups records (title, uid) of all groups NOT DELETED sorted by their title
- getItemLabel() : string
- Returns the label-value for fieldname $col in table, $table If $printAllWrap is set (to a "wrap") then it's wrapped around the $col value IF THE COLUMN $col DID NOT EXIST in TCA!, eg. $printAllWrap = '<strong>|</strong>' and the fieldname was 'not_found_field' then the return value would be '<strong>not_found_field</strong>'
- getLabelFromItemlist() : string
- Returns the label of the first found entry in an "items" array from $GLOBALS['TCA'] (tablename = $table/fieldname = $col) where the value is $key
- getLabelFromItemListMerged() : string
- Return the label of a field by additionally checking TsConfig values
- getLabelsFromItemsList() : string
- Splits the given key with commas and returns the list of all the localized items labels, separated by a comma.
- getLinkToDataHandlerAction() : string
- Returns a URL with a command to TYPO3 Datahandler
- getLiveVersionIdOfRecord() : int|null
- Gets the id of the live version of a record.
- getLiveVersionOfRecord() : array<string|int, mixed>|null
- Returns live version of record
- getModuleData() : array<string|int, mixed>
- Returns an array which is most backend modules becomes MOD_SETTINGS containing values from function menus etc. determining the function of the module.
- getNoRecordTitle() : string
- Get a localized [No title] string, wrapped in <em>|</em> if $prep is TRUE.
- getPagesTSconfig() : array<string|int, mixed>
- Returns the Page TSconfig for page with id, $id
- getPossibleWorkspaceVersionIdsOfLiveRecordIds() : array<int, int>
- Use this function if you have a large set of IDs to find out which ones have a counterpart within a workspace.
- getPreviewUrl() : string
- Returns the preview url
- getProcessedValue() : string|null
- Returns a human readable output of a value from a record For instance a database record relation would be looked up to display the title-value of that record. A checkbox with a "1" value would be "Yes", etc.
- getProcessedValueExtra() : string
- Same as ->getProcessedValue() but will go easy on fields like "tstamp" and "pid" which are not configured in TCA - they will be formatted by this function instead.
- getRecord() : array<string|int, mixed>|null
- Gets record with uid = $uid from $table You can set $field to a list of fields (default is '*') Additional WHERE clauses can be added by $where (fx. ' AND some_field = 1') Will automatically check if records has been deleted and if so, not return anything.
- getRecordIconAltText() : string
- Returns title-attribute information for ANY record (from a table defined in TCA of course) The included information depends on features of the table, but if hidden, starttime, endtime and fe_group fields are configured for, information about the record status in regard to these features are is included.
- getRecordLocalization() : mixed
- Fetches the localization for a given record.
- getRecordPath() : mixed
- Returns the path (visually) of a page $uid, fx. "/First page/Second page/Another subpage" Each part of the path will be limited to $titleLimit characters Deleted pages are filtered out.
- getRecordTitle() : string
- Returns the "title"-value in record, $row, from table, $table The field(s) from which the value is taken is determined by the "ctrl"-entries 'label', 'label_alt' and 'label_alt_force'
- getRecordTitlePrep() : string
- Crops a title string to a limited length and if it really was cropped, wrap it in a <span title="...">|</span>, which offers a tooltip with the original title when moving mouse over it.
- getRecordToolTip() : string
- Returns the combined markup for Bootstraps tooltips
- getRecordWSOL() : array<string|int, mixed>|null
- Like getRecord(), but overlays workspace version if any.
- getTcaFieldConfiguration() : array<string|int, mixed>
- Gets the TCA configuration of a field.
- getTCAtypeValue() : string
- Returns the "type" value of $rec from $table which can be used to look up the correct "types" rendering section in $GLOBALS['TCA'] If no "type" field is configured in the "ctrl"-section of the $GLOBALS['TCA'] for the table, zero is used.
- getTCEFORM_TSconfig() : array<string|int, mixed>
- Returns TSConfig for the TCEFORM object in Page TSconfig.
- getThumbnailUrl() : string
- getTSconfig_pidValue() : int|null
- Find the real PID of the record (with $uid from $table).
- getTSCpid() : array<string|int, mixed>
- Returns the REAL pid of the record, if possible. If both $uid and $pid is strings, then pid=-1 is returned as an error indication.
- getTSCpidCached() : array<string|int, mixed>
- Return the real pid of a record and caches the result.
- getUpdateSignalCode() : string
- Call to update the page tree frame (or something else..?) if this is set by the function setUpdateSignal(). It will return some JavaScript that does the update
-
getUpdateSignalDetails()
: array{html: list
, script: list } - Gets instructions for update signals (e.g. page tree shall be refreshed, since some page title has been modified during the current HTTP request).
- getUserNames() : array<string|int, mixed>
- Returns an array with be_users records of all user NOT DELETED sorted by their username Keys in the array is the be_users uid
- getWorkspaceVersionOfRecord() : array<string|int, mixed>|bool
- Select the workspace version of a record, if exists
- helpText() : string
- Returns CSH help text
- helpTextArray() : array<string|int, mixed>
- Returns CSH help text (description), if configured for, as an array (title, description)
- isModuleSetInTBE_MODULES() : bool
- Returns TRUE if $modName is set and is found as a main- or submodule in $TBE_MODULES array
- isRecordLocked() : array<string|int, mixed>|bool
- Returns information about whether the record from table, $table, with uid, $uid is currently locked (edited by another user - which should issue a warning).
- isRootLevelRestrictionIgnored() : bool
- Whether to ignore restrictions on root-level records.
- isTableLocalizable() : bool
- Determines whether a table is localizable and has the languageField and transOrigPointerField set in $GLOBALS['TCA'].
- isTableWorkspaceEnabled() : bool
- Determines whether a table is enabled for workspaces.
- isWebMountRestrictionIgnored() : bool
- Whether to ignore restrictions on a web-mount of a table.
- lockRecords() : mixed
- Unlock or Lock a record from $table with $uid If $table and $uid is not set, then all locking for the current BE_USER is removed!
- openPageTree() : mixed
- Opens the page tree to the specified page id
- purgeComputedPropertiesFromRecord() : array<string, mixed>
- Purges computed properties starting with underscore character ('_').
- purgeComputedPropertyNames() : array<string|int, mixed>
- Purges computed property names starting with underscore character ('_').
- readPageAccess() : array<string|int, mixed>|false
- Returns a page record (of page with $id) with an extra field "_thePath" set to the record path IF the WHERE clause, $perms_clause, selects the record. Thus is works as an access check that returns a page record if access was granted, otherwise not.
- referenceCount() : string|int
- Counting references to a record/file
- resolveFileReferences() : array<string|int, FileReference>|null
- Resolves file references for a given record.
- selectVersionsOfRecord() : array<string|int, mixed>|null
- Select all versions of a record, ordered by latest created version (uid DESC)
- setUpdateSignal() : mixed
- Call to update the page tree frame (or something else..?) after use 'updatePageTree' as a first parameter will set the page tree to be updated.
- softRefParserObj() : mixed
- Returns soft-reference parser for the softRef processing type Usage: $softRefObj = BackendUtility::softRefParserObj('[parser key]');
- splitTable_Uid() : array<string|int, mixed>
- Makes a backwards explode on the $str and returns an array with ($table, $uid).
- thumbCode() : string
- Returns a linked image-tag for thumbnail(s)/fileicons/truetype-font-previews from a database row with sys_file_references All $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'] extension are made to thumbnails + ttf file (renders font-example) Thumbnails are linked to ShowItemController (/thumbnails route)
- time() : string
- Returns $value (in seconds) formatted as hh:mm:ss For instance $value = 3600 + 60*2 + 3 should return "01:02:03"
- titleAttribForPages() : string
- Returns title-attribute information for a page-record informing about id, doktype, hidden, starttime, endtime, fe_group etc.
- translationCount() : string
- Counting translations of records
- viewOnClick() : string
- Returns a JavaScript string for viewing the page id, $id It will re-use any window already open.
- workspaceOL() : mixed
- Workspace Preview Overlay.
- wrapClickMenuOnIcon() : string|array<string|int, mixed>
- Makes click menu link (context sensitive menu)
- wrapInHelp() : string
- API function that wraps the text / html in help text, so if a user hovers over it the help text will show up
- wsMapId() : int
- Performs mapping of new uids to new versions UID in case of import inside a workspace.
- buildScriptUrl() : string
- Builds the URL to the current script with given arguments
- getBackendUserAuthentication() : BackendUserAuthentication|null
- getConnectionForTable() : Connection
- getLanguageService() : LanguageService
- getLogger() : LoggerInterface
- getPageForRootline() : array<string|int, mixed>
- Gets the cached page record for the rootline
- getQueryBuilderForTable() : QueryBuilder
- getRecordsSortedByTitle() : array<string|int, mixed>
- Returns an array of all non-deleted records of a table sorted by a given title field.
- getRuntimeCache() : FrontendInterface
- Gets an instance of the runtime cache.
- resolveRelationLabels() : array<string|int, mixed>
- Helper method to fetch all labels for all relations of processed Values.
Methods
ADMCMD_previewCmds()
Creates ADMCMD parameters for the "viewpage" extension / frontend
public
static ADMCMD_previewCmds(array<string|int, mixed> $pageInfo, Context $context) : string
Parameters
- $pageInfo : array<string|int, mixed>
-
Page record
- $context : Context
Return values
string —Query-parameters
BEenableFields()
Backend implementation of enableFields() Notice that "fe_groups" is not selected for - only disabled, starttime and endtime.
public
static BEenableFields(string $table[, bool $inv = false ]) : string
Notice that deleted-fields are NOT filtered - you must ALSO call deleteClause in addition. $GLOBALS["SIM_ACCESS_TIME"] is used for date.
Parameters
- $table : string
-
The table from which to return enableFields WHERE clause. Table name must have a 'ctrl' section in $GLOBALS['TCA'].
- $inv : bool = false
-
Means that the query will select all records NOT VISIBLE records (inverted selection)
should only be used from within TYPO3 Core, but DefaultRestrictionHandler is recommended as alternative
Return values
string —WHERE clause part
BEgetRootLine()
Returns what is called the 'RootLine'. That is an array with information about the page records from a page id ($uid) and back to the root.
public
static BEgetRootLine(int $uid[, string $clause = '' ][, bool $workspaceOL = false ][, array<string|int, string> $additionalFields = [] ]) : array<string|int, mixed>
By default deleted pages are filtered. This RootLine will follow the tree all the way to the root. This is opposite to another kind of root line known from the frontend where the rootline stops when a root-template is found.
Parameters
- $uid : int
-
Page id for which to create the root line.
- $clause : string = ''
-
Clause can be used to select other criteria. It would typically be where-clauses that stops the process if we meet a page, the user has no reading access to.
- $workspaceOL : bool = false
-
If TRUE, version overlay is applied. This must be requested specifically because it is usually only wanted when the rootline is used for visual output while for permission checking you want the raw thing!
- $additionalFields : array<string|int, string> = []
-
Additional Fields to select for rootline records
Return values
array<string|int, mixed> —Root line array, all the way to the page tree root uid=0 (or as far as $clause allows!), including the page given as $uid
calcAge()
Returns the "age" in minutes / hours / days / years of the number of $seconds inputted.
public
static calcAge(int $seconds[, string $labels = 'min|hrs|days|yrs|min|hour|day|year' ]) : string
Parameters
- $seconds : int
-
Seconds could be the difference of a certain timestamp and time()
- $labels : string = 'min|hrs|days|yrs|min|hour|day|year'
-
Labels should be something like ' min| hrs| days| yrs| min| hour| day| year'. This value is typically delivered by this function call: $GLOBALS["LANG"]->sL("LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.minutesHoursDaysYears")
Return values
string —Formatted time
cshItem()
API for getting CSH icons/text for use in backend modules.
public
static cshItem(string $table, string $field[, string $_ = '' ][, string $wrap = '' ]) : string
TCA_DESCR will be loaded if it isn't already
Parameters
- $table : string
-
Table name ('MOD'+module name)
- $field : string
-
Field name (CSH locallang main key)
- $_ : string = ''
-
(unused)
- $wrap : string = ''
-
Wrap code for icon-mode, splitted by "|". Not used for full-text mode.
Return values
string —HTML content for help text
date()
Returns $tstamp formatted as "ddmmyy" (According to $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'])
public
static date(int $tstamp) : string
Parameters
- $tstamp : int
-
Time stamp, seconds
Return values
string —Formatted time
datetime()
Returns $tstamp formatted as "ddmmyy hhmm" (According to $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'] AND $GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'])
public
static datetime(int $value) : string
Parameters
- $value : int
-
Time stamp, seconds
Return values
string —Formatted time
dateTimeAge()
Returns a formatted timestamp if $tstamp is set.
public
static dateTimeAge(int $tstamp[, int $prefix = 1 ][, string $date = '' ]) : string
The date/datetime will be followed by the age in parenthesis.
Parameters
- $tstamp : int
-
Time stamp, seconds
- $prefix : int = 1
-
1/-1 depending on polarity of age.
- $date : string = ''
-
$date=="date" will yield "dd:mm:yy" formatting, otherwise "dd:mm:yy hh:mm
Return values
stringdaysUntil()
Returns the difference in days between input $tstamp and $EXEC_TIME
public
static daysUntil(int $tstamp) : int
Parameters
- $tstamp : int
-
Time stamp, seconds
Return values
intexplodeSoftRefParserList()
Returns array of soft parser references
public
static explodeSoftRefParserList(string $parserList) : array<string|int, mixed>|bool
will be removed in TYPO3 v12.0. Use SoftReferenceParserFactory->getParsersBySoftRefParserList instead.
Parameters
- $parserList : string
-
softRef parser list
should only be used from within TYPO3 Core
Tags
Return values
array<string|int, mixed>|bool —Array where the parser key is the key and the value is the parameter string, FALSE if no parsers were found
fixVersioningPid()
Find page-tree PID for versionized record Used whenever you are tracking something back, like making the root line.
public
static fixVersioningPid(string $table, array<string|int, mixed> &$rr[, bool $ignoreWorkspaceMatch = false ]) : mixed
will be removed in TYPO3 v12, use workspaceOL() or getRecordWSOL() directly to achieve the same result.
Will only translate if the workspace of the input record matches that of the current user (unless flag set) Principle; Record offline! => Find online?
If the record had its pid corrected to the online versions pid, then "_ORIG_pid" is set for moved records to the PID of the moved location.
Parameters
- $table : string
-
Table name
- $rr : array<string|int, mixed>
-
Record array passed by reference. As minimum, "pid" and "uid" fields must exist! "t3ver_oid", "t3ver_state" and "t3ver_wsid" is nice and will save you a DB query.
- $ignoreWorkspaceMatch : bool = false
-
Ignore workspace match
should only be used from within TYPO3 Core
Tags
getAllowedFieldsForTable()
Get all fields of a table, which are allowed for the current user
public
static getAllowedFieldsForTable(string $table[, bool $checkUserAccess = true ]) : array<string|int, string>
Parameters
- $table : string
-
Table name
- $checkUserAccess : bool = true
-
If set, users access to the field (non-exclude-fields) is checked.
should only be used from within TYPO3 Core
Return values
array<string|int, string> —Array, where values are fieldnames
getClickMenuOnIconTagParameters()
public
static getClickMenuOnIconTagParameters(string $table[, int|string $uid = 0 ][, string $context = '' ]) : array<string|int, mixed>
Parameters
- $table : string
-
Table name/File path. If the icon is for a database record, enter the tablename from $GLOBALS['TCA']. If a file then enter the absolute filepath
- $uid : int|string = 0
-
If icon is for database record this is the UID for the record from $table or identifier for sys_file record
- $context : string = ''
-
Set tree if menu is called from tree view
Return values
array<string|int, mixed>getCommonSelectFields()
Returns fields for a table, $table, which would typically be interesting to select This includes uid, the fields defined for title, icon-field.
public
static getCommonSelectFields(string $table[, string $prefix = '' ][, array<string|int, mixed> $fields = [] ]) : string
Returned as a list ready for query ($prefix can be set to eg. "pages." if you are selecting from the pages table and want the table name prefixed)
Parameters
- $table : string
-
Table name, present in $GLOBALS['TCA']
- $prefix : string = ''
-
Table prefix
- $fields : array<string|int, mixed> = []
-
Preset fields (must include prefix if that is used)
should only be used from within TYPO3 Core
Tags
Return values
string —List of fields.
getDropdownMenu()
Returns a selector box to switch the view Based on BackendUtility::getFuncMenu() but done as new function because it has another purpose.
public
static getDropdownMenu(mixed $mainParams, string $elementName, string $currentValue, array<string|int, mixed> $menuItems[, string $script = '' ][, string $addParams = '' ]) : string
Mingling with getFuncMenu would harm the docHeader Menu.
Parameters
- $mainParams : mixed
-
The "&id=" parameter value to be sent to the module, but it can be also a parameter array which will be passed instead of the &id=...
- $elementName : string
-
The form elements name, probably something like "SET[...]
- $currentValue : string
-
The value to be selected currently.
- $menuItems : array<string|int, mixed>
-
An array with the menu items for the selector box
- $script : string = ''
-
The script to send the &id to, if empty it's automatically found
- $addParams : string = ''
-
Additional parameters to pass to the script.
Return values
string —HTML code for selector box
getFuncCheck()
Checkbox function menu.
public
static getFuncCheck(mixed $mainParams, string $elementName, string|bool $currentValue[, string $script = '' ][, string $addParams = '' ][, string $tagParams = '' ]) : string
Works like ->getFuncMenu() but takes no $menuItem array since this is a simple checkbox.
Parameters
- $mainParams : mixed
-
$id is the "&id=" parameter value to be sent to the module, but it can be also a parameter array which will be passed instead of the &id=...
- $elementName : string
-
The form elements name, probably something like "SET[...]
- $currentValue : string|bool
-
The value to be selected currently.
- $script : string = ''
-
The script to send the &id to, if empty it's automatically found
- $addParams : string = ''
-
Additional parameters to pass to the script.
- $tagParams : string = ''
-
Additional attributes for the checkbox input tag
Tags
Return values
string —HTML code for checkbox
getFuncInput()
Input field function menu Works like ->getFuncMenu() / ->getFuncCheck() but displays an input field instead which updates the script "onchange"
public
static getFuncInput(mixed $mainParams, string $elementName, string $currentValue[, int $size = 10 ][, string $script = '' ][, string $addParams = '' ]) : string
Parameters
- $mainParams : mixed
-
$id is the "&id=" parameter value to be sent to the module, but it can be also a parameter array which will be passed instead of the &id=...
- $elementName : string
-
The form elements name, probably something like "SET[...]
- $currentValue : string
-
The value to be selected currently.
- $size : int = 10
-
Relative size of input field, max is 48
- $script : string = ''
-
The script to send the &id to, if empty it's automatically found
- $addParams : string = ''
-
Additional parameters to pass to the script.
Tags
Return values
string —HTML code for input text field.
getFuncMenu()
Returns a selector box "function menu" for a module
public
static getFuncMenu(mixed $mainParams, string $elementName, string $currentValue, array<string|int, mixed> $menuItems[, string $script = '' ][, string $addParams = '' ]) : string
Parameters
- $mainParams : mixed
-
The "&id=" parameter value to be sent to the module, but it can be also a parameter array which will be passed instead of the &id=...
- $elementName : string
-
The form elements name, probably something like "SET[...]
- $currentValue : string
-
The value to be selected currently.
- $menuItems : array<string|int, mixed>
-
An array with the menu items for the selector box
- $script : string = ''
-
The script to send the &id to, if empty it's automatically found
- $addParams : string = ''
-
Additional parameters to pass to the script.
Return values
string —HTML code for selector box
getGroupNames()
Returns an array with be_groups records (title, uid) of all groups NOT DELETED sorted by their title
public
static getGroupNames([string $fields = 'title,uid' ][, string $where = '' ]) : array<string|int, mixed>
Parameters
- $fields : string = 'title,uid'
-
Field list
- $where : string = ''
-
WHERE clause
should only be used from within TYPO3 Core, use a direct SQL query instead to ensure proper DBAL where statements
Return values
array<string|int, mixed>getItemLabel()
Returns the label-value for fieldname $col in table, $table If $printAllWrap is set (to a "wrap") then it's wrapped around the $col value IF THE COLUMN $col DID NOT EXIST in TCA!, eg. $printAllWrap = '<strong>|</strong>' and the fieldname was 'not_found_field' then the return value would be '<strong>not_found_field</strong>'
public
static getItemLabel(string $table, string $col) : string
Parameters
- $table : string
-
Table name, present in $GLOBALS['TCA']
- $col : string
-
Field name
Return values
string —or NULL if $col is not found in the TCA table
getLabelFromItemlist()
Returns the label of the first found entry in an "items" array from $GLOBALS['TCA'] (tablename = $table/fieldname = $col) where the value is $key
public
static getLabelFromItemlist(string $table, string $col, string $key) : string
Parameters
- $table : string
-
Table name, present in $GLOBALS['TCA']
- $col : string
-
Field name, present in $GLOBALS['TCA']
- $key : string
-
items-array value to match
Return values
string —Label for item entry
getLabelFromItemListMerged()
Return the label of a field by additionally checking TsConfig values
public
static getLabelFromItemListMerged(int $pageId, string $table, string $column, string $key) : string
Parameters
- $pageId : int
-
Page id
- $table : string
-
Table name
- $column : string
-
Field Name
- $key : string
-
item value
Return values
string —Label for item entry
getLabelsFromItemsList()
Splits the given key with commas and returns the list of all the localized items labels, separated by a comma.
public
static getLabelsFromItemsList(string $table, string $column, string $keyList[, array<string|int, mixed> $columnTsConfig = [] ]) : string
NOTE: this does not take itemsProcFunc into account
Parameters
- $table : string
-
Table name, present in TCA
- $column : string
-
Field name
- $keyList : string
-
Key or comma-separated list of keys.
- $columnTsConfig : array<string|int, mixed> = []
-
page TSConfig for $column (TCEMAIN.
.
) Return values
string —Comma-separated list of localized labels
getLinkToDataHandlerAction()
Returns a URL with a command to TYPO3 Datahandler
public static getLinkToDataHandlerAction(string $parameters[, string $redirectUrl = '' ]) : string
Parameters
- $parameters : string
-
Set of GET params to send. Example: "&cmd[tt_content][123][move]=456" or "&data[tt_content][123][hidden]=1&data[tt_content][123][title]=Hello%20World
- $redirectUrl : string = ''
-
Redirect URL, default is to use $GLOBALS['TYPO3_REQUEST']->getAttribute('normalizedParams')->getRequestUri()
Return values
stringgetLiveVersionIdOfRecord()
Gets the id of the live version of a record.
public static getLiveVersionIdOfRecord(string $table, int|string $uid) : int|null
Parameters
- $table : string
-
Name of the table
- $uid : int|string
-
Uid of the offline/draft record
Internal should only be used from within TYPO3 Core
Return values
int|null —The id of the live version of the record (or NULL if nothing was found)
getLiveVersionOfRecord()
Returns live version of record
public static getLiveVersionOfRecord(string $table, int|string $uid[, string $fields = '*' ]) : array<string|int, mixed>|null
Parameters
- $table : string
-
Table name
- $uid : int|string
-
Record UID of draft, offline version
- $fields : string = '*'
-
Field list, default is *
Return values
array<string|int, mixed>|null —If found, the record, otherwise NULL
getModuleData()
Returns an array which is most backend modules becomes MOD_SETTINGS containing values from function menus etc. determining the function of the module.
public static getModuleData(array<string|int, mixed> $MOD_MENU, array<string|int, mixed> $CHANGED_SETTINGS, string $modName[, string $type = '' ][, string $dontValidateList = '' ][, string $setDefaultList = '' ]) : array<string|int, mixed>
This is kind of session variable management framework for the backend users. If a key from MOD_MENU is set in the CHANGED_SETTINGS array (eg. a value is passed to the script from the outside), this value is put into the settings-array
Parameters
- $MOD_MENU : array<string|int, mixed>
-
MOD_MENU is an array that defines the options in menus.
- $CHANGED_SETTINGS : array<string|int, mixed>
-
CHANGED_SETTINGS represents the array used when passing values to the script from the menus.
- $modName : string
-
modName is the name of this module. Used to get the correct module data.
- $type : string = ''
-
If type is 'ses' then the data is stored as session-lasting data. This means that it'll be wiped out the next time the user logs in.
- $dontValidateList : string = ''
-
dontValidateList can be used to list variables that should not be checked if their value is found in the MOD_MENU array. Used for dynamically generated menus.
- $setDefaultList : string = ''
-
List of default values from $MOD_MENU to set in the output array (only if the values from MOD_MENU are not arrays)
Tags
Return values
array<string|int, mixed> —The array $settings, which holds a key for each MOD_MENU key and the values of each key will be within the range of values for each menuitem
getNoRecordTitle()
Get a localized [No title] string, wrapped in <em>|</em> if $prep is TRUE.
public static getNoRecordTitle([bool $prep = false ]) : string
Parameters
- $prep : bool = false
-
Wrap result in |
Return values
string —Localized [No title] string
getPagesTSconfig()
Returns the Page TSconfig for page with id, $id
public static getPagesTSconfig(int $id) : array<string|int, mixed>
Parameters
- $id : int
-
Page uid for which to create Page TSconfig
Tags
Return values
array<string|int, mixed> —Page TSconfig
getPossibleWorkspaceVersionIdsOfLiveRecordIds()
Use this function if you have a large set of IDs to find out which ones have a counterpart within a workspace.
public static getPossibleWorkspaceVersionIdsOfLiveRecordIds(string $table, array<string|int, mixed> $liveRecordIds, int $workspaceId) : array<int, int>
Within a workspace, this is one additional query, so use it only if you have a set of > 2 to find out if you really need to call BackendUtility::workspaceOL() all the time.
If you have 1000 records, but only have two 2 records which have been modified in a workspace, only 2 items are returned.
Parameters
- $table : string
- $liveRecordIds : array<string|int, mixed>
- $workspaceId : int
Internal this method is not public API and might change, as you really should know what you are doing.
Return values
array<int, int> —keys contain the live record ID, values the versioned record ID
getPreviewUrl()
Returns the preview url
public static getPreviewUrl(int $pageUid[, string $backPath = '' ][, array<string|int, mixed>|null $rootLine = null ][, string $anchorSection = '' ][, string $alternativeUrl = '' ][, string $additionalGetVars = '' ][, bool &$switchFocus = true ]) : string
It will detect the correct domain name if needed and provide the link with the right back path.
Parameters
- $pageUid : int
-
Page UID
- $backPath : string = ''
-
Must point back to TYPO3_mainDir (where the site is assumed to be one level above)
- $rootLine : array<string|int, mixed>|null = null
-
If root line is supplied the function will look for the first found domain record and use that URL instead (if found)
- $anchorSection : string = ''
-
Optional anchor to the URL
- $alternativeUrl : string = ''
-
An alternative URL that, if set, will ignore other parameters except $switchFocus: It will return the window.open command wrapped around this URL!
- $additionalGetVars : string = ''
-
Additional GET variables.
- $switchFocus : bool = true
-
If TRUE, then the preview window will gain the focus.
Return values
stringgetProcessedValue()
Returns a human readable output of a value from a record For instance a database record relation would be looked up to display the title-value of that record. A checkbox with a "1" value would be "Yes", etc.
public static getProcessedValue(string $table, string $col, mixed $value[, int $fixed_lgd_chars = 0 ][, bool $defaultPassthrough = false ][, bool $noRecordLookup = false ][, int $uid = 0 ][, bool $forceResult = true ][, int $pid = 0 ]) : string|null
$table/$col is tablename and fieldname REMEMBER to pass the output through htmlspecialchars() if you output it to the browser! (To protect it from XSS attacks and be XHTML compliant)
Parameters
- $table : string
-
Table name, present in TCA
- $col : string
-
Field name, present in TCA
- $value : mixed
-
The value of that field from a selected record
- $fixed_lgd_chars : int = 0
-
The max amount of characters the value may occupy
- $defaultPassthrough : bool = false
-
Flag means that values for columns that has no conversion will just be pass through directly (otherwise cropped to 200 chars or returned as "N/A")
- $noRecordLookup : bool = false
-
If set, no records will be looked up, UIDs are just shown.
- $uid : int = 0
-
Uid of the current record
- $forceResult : bool = true
-
If BackendUtility::getRecordTitle is used to process the value, this parameter is forwarded.
- $pid : int = 0
-
Optional page uid is used to evaluate page TSConfig for the given field
Tags
Return values
string|nullgetProcessedValueExtra()
Same as ->getProcessedValue() but will go easy on fields like "tstamp" and "pid" which are not configured in TCA - they will be formatted by this function instead.
public static getProcessedValueExtra(string $table, string $fN, string $fV[, int $fixed_lgd_chars = 0 ][, int $uid = 0 ][, bool $forceResult = true ][, int $pid = 0 ]) : string
Parameters
- $table : string
-
Table name, present in TCA
- $fN : string
-
Field name
- $fV : string
-
Field value
- $fixed_lgd_chars : int = 0
-
The max amount of characters the value may occupy
- $uid : int = 0
-
Uid of the current record
- $forceResult : bool = true
-
If BackendUtility::getRecordTitle is used to process the value, this parameter is forwarded.
- $pid : int = 0
-
Optional page uid is used to evaluate page TSConfig for the given field
Tags
Return values
stringgetRecord()
Gets record with uid = $uid from $table You can set $field to a list of fields (default is '*') Additional WHERE clauses can be added by $where (fx. ' AND some_field = 1') Will automatically check if records has been deleted and if so, not return anything.
public static getRecord(string $table, int|string $uid[, string $fields = '*' ][, string $where = '' ][, bool $useDeleteClause = true ]) : array<string|int, mixed>|null
$table must be found in $GLOBALS['TCA']
Parameters
- $table : string
-
Table name present in $GLOBALS['TCA']
- $uid : int|string
-
UID of record
- $fields : string = '*'
-
List of fields to select
- $where : string = ''
-
Additional WHERE clause, eg. ' AND some_field = 0'
- $useDeleteClause : bool = true
-
Use the deleteClause to check if a record is deleted (default TRUE)
Return values
array<string|int, mixed>|null —Returns the row if found, otherwise NULL
getRecordIconAltText()
Returns title-attribute information for ANY record (from a table defined in TCA of course) The included information depends on features of the table, but if hidden, starttime, endtime and fe_group fields are configured for, information about the record status in regard to these features are is included.
public static getRecordIconAltText(array<string|int, mixed> $row[, string $table = 'pages' ]) : string
"pages" table can be used as well and will return the result of ->titleAttribForPages() for that page.
Parameters
- $row : array<string|int, mixed>
-
Table row; $row is a row from the table, $table
- $table : string = 'pages'
-
Table name
Return values
stringgetRecordLocalization()
Fetches the localization for a given record.
public static getRecordLocalization(string $table, int $uid, int $language[, string $andWhereClause = '' ]) : mixed
Parameters
- $table : string
-
Table name present in $GLOBALS['TCA']
- $uid : int
-
The uid of the record
- $language : int
-
The uid of the language record in sys_language
- $andWhereClause : string = ''
-
Optional additional WHERE clause (default: '')
Return values
mixed —Multidimensional array with selected records, empty array if none exists and FALSE if table is not localizable
getRecordPath()
Returns the path (visually) of a page $uid, fx. "/First page/Second page/Another subpage" Each part of the path will be limited to $titleLimit characters Deleted pages are filtered out.
public static getRecordPath(int $uid, string $clause, int $titleLimit[, int $fullTitleLimit = 0 ]) : mixed
Parameters
- $uid : int
-
Page uid for which to create record path
- $clause : string
-
Clause is additional where clauses, eg.
- $titleLimit : int
-
Title limit
- $fullTitleLimit : int = 0
-
Title limit of Full title (typ. set to 1000 or so)
Return values
mixed —Path of record (string) OR array with short/long title if $fullTitleLimit is set.
getRecordTitle()
Returns the "title"-value in record, $row, from table, $table The field(s) from which the value is taken is determined by the "ctrl"-entries 'label', 'label_alt' and 'label_alt_force'
public static getRecordTitle(string $table, array<string|int, mixed> $row[, bool $prep = false ][, bool $forceResult = true ]) : string
Parameters
- $table : string
-
Table name, present in TCA
- $row : array<string|int, mixed>
-
Row from table
- $prep : bool = false
-
If set, result is prepared for output: The output is cropped to a limited length (depending on BE_USER->uc['titleLen']) and if no value is found for the title, '[No title]' is returned (localized). Further, the output is htmlspecialchars()'ed
- $forceResult : bool = true
-
If set, the function always returns an output. If no value is found for the title, '[No title]' is returned (localized).
Return values
stringgetRecordTitlePrep()
Crops a title string to a limited length and if it really was cropped, wrap it in a <span title="...">|</span>, which offers a tooltip with the original title when moving mouse over it.
public static getRecordTitlePrep(string $title[, int $titleLength = 0 ]) : string
Parameters
- $title : string
-
The title string to be cropped
- $titleLength : int = 0
-
Crop title after this length - if not set, BE_USER->uc['titleLen'] is used
Return values
string —The processed title string, wrapped in | if cropped
getRecordToolTip()
Returns the combined markup for Bootstraps tooltips
public static getRecordToolTip(array<string|int, mixed> $row[, string $table = 'pages' ]) : string
Parameters
- $row : array<string|int, mixed>
- $table : string = 'pages'
Return values
stringgetRecordWSOL()
Like getRecord(), but overlays workspace version if any.
public static getRecordWSOL(string $table, int $uid[, string $fields = '*' ][, string $where = '' ][, bool $useDeleteClause = true ][, bool $unsetMovePointers = false ]) : array<string|int, mixed>|null
Parameters
- $table : string
-
Table name present in $GLOBALS['TCA']
- $uid : int
-
UID of record
- $fields : string = '*'
-
List of fields to select
- $where : string = ''
-
Additional WHERE clause, eg. ' AND some_field = 0'
- $useDeleteClause : bool = true
-
Use the deleteClause to check if a record is deleted (default TRUE)
- $unsetMovePointers : bool = false
-
If TRUE the function does not return a "pointer" row for moved records in a workspace
Return values
array<string|int, mixed>|null —Returns the row if found, else NULL
getTcaFieldConfiguration()
Gets the TCA configuration of a field.
public static getTcaFieldConfiguration(string $table, string $field) : array<string|int, mixed>
Parameters
- $table : string
-
Name of the table
- $field : string
-
Name of the field
Return values
array<string|int, mixed>getTCAtypeValue()
Returns the "type" value of $rec from $table which can be used to look up the correct "types" rendering section in $GLOBALS['TCA'] If no "type" field is configured in the "ctrl"-section of the $GLOBALS['TCA'] for the table, zero is used.
public static getTCAtypeValue(string $table, array<string|int, mixed> $row) : string
If zero is not an index in the "types" section of $GLOBALS['TCA'] for the table, then the $fieldValue returned will default to 1 (no matter if that is an index or not)
Note: This method is very similar to the type determination of FormDataProvider/DatabaseRecordTypeValue, however, it has two differences:
- The method in TCEForms also takes care of localization (which is difficult to do here as the whole infrastructure for language overlays is only in TCEforms).
- The $row array looks different in TCEForms, as in there it's not the raw record but the prepared data from other providers is handled, which changes e.g. how "select" and "group" field values are stored, which makes different processing of the "foreign pointer field" type field variant necessary.
Parameters
- $table : string
-
Table name present in TCA
- $row : array<string|int, mixed>
-
Record from $table
Tags
Return values
string —Field value
getTCEFORM_TSconfig()
Returns TSConfig for the TCEFORM object in Page TSconfig.
public static getTCEFORM_TSconfig(string $table, array<string|int, mixed> $row) : array<string|int, mixed>
Used in TCEFORMs
Parameters
- $table : string
-
Table name present in TCA
- $row : array<string|int, mixed>
-
Row from table
Return values
array<string|int, mixed>getThumbnailUrl()
public static getThumbnailUrl(int $fileId, array<string|int, mixed> $configuration) : string
Parameters
- $fileId : int
- $configuration : array<string|int, mixed>
Return values
stringgetTSconfig_pidValue()
Find the real PID of the record (with $uid from $table).
public static getTSconfig_pidValue(string $table, int $uid, int|string $pid) : int|null
This MAY be impossible if the pid is set as a reference to the former record or a page (if two records are created at one time).
Parameters
- $table : string
-
Table name
- $uid : int
-
Record uid
- $pid : int|string
-
Record pid, could be negative then pointing to a record from same table whose pid to find and return
Internal Tags
Return values
int|nullgetTSCpid()
Returns the REAL pid of the record, if possible. If both $uid and $pid is strings, then pid=-1 is returned as an error indication.
public static getTSCpid(string $table, int $uid, int|string $pid) : array<string|int, mixed>
Parameters
- $table : string
-
Table name
- $uid : int
-
Record uid
- $pid : int|string
-
Record pid
Internal Tags
Return values
array<string|int, mixed> —Array of two integers; first is the REAL PID of a record and if its a new record negative values are resolved to the true PID, second value is the PID value for TSconfig (uid if table is pages, otherwise the pid)
getTSCpidCached()
Return the real pid of a record and caches the result.
public static getTSCpidCached(string $table, string $uid, string $pid) : array<string|int, mixed>
The non-cached method needs database queries to do the job, so this method can be used if code sometimes calls the same record multiple times to save some queries. This should not be done if the calling code may change the same record meanwhile.
Parameters
- $table : string
-
Tablename
- $uid : string
-
UID value
- $pid : string
-
PID value
Return values
array<string|int, mixed> —Array of two integers; first is the real PID of a record, second is the PID value for TSconfig.
getUpdateSignalCode()
Call to update the page tree frame (or something else..?) if this is set by the function setUpdateSignal(). It will return some JavaScript that does the update
public static getUpdateSignalCode() : string
Internal use getUpdateSignalDetails() instead, will be deprecated in TYPO3 v12.0
Tags
Return values
string —HTML javascript code
getUpdateSignalDetails()
Gets instructions for update signals (e.g. page tree shall be refreshed, since some page title has been modified during the current HTTP request).
public static getUpdateSignalDetails() : array{html: list
, script: list } Tags
Return values
array{html: list, script: list } getUserNames()
Returns an array with be_users records of all user NOT DELETED sorted by their username Keys in the array is the be_users uid
public static getUserNames([string $fields = 'username,usergroup,uid' ][, string $where = '' ]) : array<string|int, mixed>
Parameters
- $fields : string = 'username,usergroup,uid'
-
Optional $fields list (default: username,usergroup,uid) can be used to set the selected fields
- $where : string = ''
-
Optional $where clause (fx. "AND username='pete'") can be used to limit query
Internal should only be used from within TYPO3 Core, use a direct SQL query instead to ensure proper DBAL where statements
Return values
array<string|int, mixed>getWorkspaceVersionOfRecord()
Select the workspace version of a record, if exists
public static getWorkspaceVersionOfRecord(int $workspace, string $table, int $uid[, string $fields = '*' ]) : array<string|int, mixed>|bool
Parameters
- $workspace : int
-
Workspace ID
- $table : string
-
Table name to select from
- $uid : int
-
Record uid for which to find workspace version.
- $fields : string = '*'
-
Field list to select
Return values
array<string|int, mixed>|bool —If found, return record, otherwise false
helpText()
Returns CSH help text
public static helpText(string $table, string $field) : string
Parameters
- $table : string
-
Table name
- $field : string
-
Field name
Internal should only be used from within TYPO3 Core
Tags
Return values
string —HTML content for help text
helpTextArray()
Returns CSH help text (description), if configured for, as an array (title, description)
public static helpTextArray(string $table, string $field) : array<string|int, mixed>
Parameters
- $table : string
-
Table name
- $field : string
-
Field name
Internal should only be used from within TYPO3 Core
Return values
array<string|int, mixed> —With keys 'description' (raw, as available in locallang), 'title' (optional), 'moreInfo'
isModuleSetInTBE_MODULES()
Returns TRUE if $modName is set and is found as a main- or submodule in $TBE_MODULES array
public static isModuleSetInTBE_MODULES(string $modName) : bool
Parameters
- $modName : string
-
Module name
Return values
boolisRecordLocked()
Returns information about whether the record from table, $table, with uid, $uid is currently locked (edited by another user - which should issue a warning).
public static isRecordLocked(string $table, int $uid) : array<string|int, mixed>|bool
Notice: Locking is not strictly carried out since locking is abandoned when other backend scripts are activated - which means that a user CAN have a record "open" without having it locked. So this just serves as a warning that counts well in 90% of the cases, which should be sufficient.
Parameters
- $table : string
-
Table name
- $uid : int
-
Record uid
Internal Return values
array<string|int, mixed>|boolisRootLevelRestrictionIgnored()
Whether to ignore restrictions on root-level records.
public static isRootLevelRestrictionIgnored(string $table) : bool
The regular behaviour is that records on the root-level (page-id 0) only can be accessed by admin users.
Parameters
- $table : string
-
Name of the table
Return values
boolisTableLocalizable()
Determines whether a table is localizable and has the languageField and transOrigPointerField set in $GLOBALS['TCA'].
public static isTableLocalizable(string $table) : bool
Parameters
- $table : string
-
The table to check
Return values
bool —Whether a table is localizable
isTableWorkspaceEnabled()
Determines whether a table is enabled for workspaces.
public static isTableWorkspaceEnabled(string $table) : bool
Parameters
- $table : string
-
Name of the table to be checked
Return values
boolisWebMountRestrictionIgnored()
Whether to ignore restrictions on a web-mount of a table.
public static isWebMountRestrictionIgnored(string $table) : bool
The regular behaviour is that records to be accessed need to be in a valid user's web-mount.
Parameters
- $table : string
-
Name of the table
Return values
boollockRecords()
Unlock or Lock a record from $table with $uid If $table and $uid is not set, then all locking for the current BE_USER is removed!
public static lockRecords([string $table = '' ][, int $uid = 0 ][, int $pid = 0 ]) : mixed
Parameters
- $table : string = ''
-
Table name
- $uid : int = 0
-
Record uid
- $pid : int = 0
-
Record pid
Internal openPageTree()
Opens the page tree to the specified page id
public static openPageTree(int $pid, bool $clearExpansion) : mixed
Parameters
- $pid : int
-
Page id.
- $clearExpansion : bool
-
If set, then other open branches are closed.
Internal should only be used from within TYPO3 Core
purgeComputedPropertiesFromRecord()
Purges computed properties starting with underscore character ('_').
public static purgeComputedPropertiesFromRecord(array<string, mixed> $record) : array<string, mixed>
Parameters
- $record : array<string, mixed>
Internal should only be used from within TYPO3 Core
Return values
array<string, mixed>purgeComputedPropertyNames()
Purges computed property names starting with underscore character ('_').
public static purgeComputedPropertyNames(array<string|int, mixed> $propertyNames) : array<string|int, mixed>
Parameters
- $propertyNames : array<string|int, mixed>
Internal should only be used from within TYPO3 Core
Return values
array<string|int, mixed>readPageAccess()
Returns a page record (of page with $id) with an extra field "_thePath" set to the record path IF the WHERE clause, $perms_clause, selects the record. Thus is works as an access check that returns a page record if access was granted, otherwise not.
public static readPageAccess(int $id, string $perms_clause) : array<string|int, mixed>|false
If $id is zero a pseudo root-page with "_thePath" set is returned IF the current BE_USER is admin. In any case ->isInWebMount must return TRUE for the user (regardless of $perms_clause)
Parameters
- $id : int
-
Page uid for which to check read-access
- $perms_clause : string
-
This is typically a value generated with static::getBackendUserAuthentication()->getPagePermsClause(1);
Return values
array<string|int, mixed>|false —Returns page record if OK, otherwise FALSE.
referenceCount()
Counting references to a record/file
public static referenceCount(string $table, string $ref[, string $msg = '' ][, string|int|null $count = null ]) : string|int
Parameters
- $table : string
-
Table name (or "_FILE" if its a file)
- $ref : string
-
Reference: If table, then int-uid, if _FILE, then file reference (relative to Environment::getPublicPath())
- $msg : string = ''
-
Message with %s, eg. "There were %s records pointing to this file!
- $count : string|int|null = null
-
Reference count
Return values
string|int —Output string (or int count value if no msg string specified)
resolveFileReferences()
Resolves file references for a given record.
public static resolveFileReferences(string $tableName, string $fieldName, array<string|int, mixed> $element[, int|null $workspaceId = null ]) : array<string|int, FileReference>|null
Parameters
- $tableName : string
-
Name of the table of the record
- $fieldName : string
-
Name of the field of the record
- $element : array<string|int, mixed>
-
Record data
- $workspaceId : int|null = null
-
Workspace to fetch data for
Return values
array<string|int, FileReference>|nullselectVersionsOfRecord()
Select all versions of a record, ordered by latest created version (uid DESC)
public static selectVersionsOfRecord(string $table, int $uid[, string $fields = '*' ][, int|null $workspace = 0 ][, bool $includeDeletedRecords = false ][, array<string|int, mixed> $row = null ]) : array<string|int, mixed>|null
Parameters
- $table : string
-
Table name to select from
- $uid : int
-
Record uid for which to find versions.
- $fields : string = '*'
-
Field list to select
- $workspace : int|null = 0
-
Search in workspace ID and Live WS, if 0 search only in LiveWS, if NULL search in all WS.
- $includeDeletedRecords : bool = false
-
If set, deleted-flagged versions are included! (Only for clean-up script!)
- $row : array<string|int, mixed> = null
-
The current record
Internal should only be used from within TYPO3 Core
Return values
array<string|int, mixed>|null —Array of versions of table/uid
setUpdateSignal()
Call to update the page tree frame (or something else..?) after use 'updatePageTree' as a first parameter will set the page tree to be updated.
public static setUpdateSignal([string $set = '' ][, mixed $params = '' ]) : mixed
Parameters
- $set : string = ''
-
Key to set the update signal. When setting, this value contains strings telling WHAT to set. At this point it seems that the value "updatePageTree" is the only one it makes sense to set. If empty, all update signals will be removed.
- $params : mixed = ''
-
Additional information for the update signal, used to only refresh a branch of the tree
Tags
softRefParserObj()
Returns soft-reference parser for the softRef processing type Usage: $softRefObj = BackendUtility::softRefParserObj('[parser key]');
public static softRefParserObj(string $spKey) : mixed
Deprecated will be removed in TYPO3 v12.0. Use SoftReferenceParserFactory->getSoftReferenceParser instead.
Parameters
- $spKey : string
-
softRef parser key
Internal should only be used from within TYPO3 Core
Return values
mixed —If available, returns Soft link parser object, otherwise false.
splitTable_Uid()
Makes a backwards explode on the $str and returns an array with ($table, $uid).
public static splitTable_Uid(string $str) : array<string|int, mixed>
Example: tt_content_45 => ['tt_content', 45]
Parameters
- $str : string
-
[tablename]_[uid] string to explode
Internal should only be used from within TYPO3 Core
Return values
array<string|int, mixed>thumbCode()
Returns a linked image-tag for thumbnail(s)/fileicons/truetype-font-previews from a database row with sys_file_references All $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'] extension are made to thumbnails + ttf file (renders font-example) Thumbnails are linked to ShowItemController (/thumbnails route)
public static thumbCode(array<string|int, mixed> $row, string $table, string $field[, string $backPath = '' ][, string $thumbScript = '' ][, string $uploaddir = null ][, int $abs = 0 ][, string $tparams = '' ][, int|string $size = '' ][, bool $linkInfoPopup = true ]) : string
Parameters
- $row : array<string|int, mixed>
-
Row is the database row from the table, $table.
- $table : string
-
Table name for $row (present in TCA)
- $field : string
-
Field is pointing to the connecting field of sys_file_references
- $backPath : string = ''
-
Back path prefix for image tag src="" field
- $thumbScript : string = ''
-
UNUSED since FAL
- $uploaddir : string = null
-
UNUSED since FAL
- $abs : int = 0
-
UNUSED
- $tparams : string = ''
-
Optional: $tparams is additional attributes for the image tags
- $size : int|string = ''
-
Optional: $size is [w]x[h] of the thumbnail. 64 is default.
- $linkInfoPopup : bool = true
-
Whether to wrap with a link opening the info popup
Return values
string —Thumbnail image tag.
time()
Returns $value (in seconds) formatted as hh:mm:ss For instance $value = 3600 + 60*2 + 3 should return "01:02:03"
public static time(int $value[, bool $withSeconds = true ]) : string
Parameters
- $value : int
-
Time stamp, seconds
- $withSeconds : bool = true
-
Output hh:mm:ss. If FALSE: hh:mm
Return values
string —Formatted time
titleAttribForPages()
Returns title-attribute information for a page-record informing about id, doktype, hidden, starttime, endtime, fe_group etc.
public static titleAttribForPages(array<string|int, mixed> $row[, string $perms_clause = '' ][, bool $includeAttrib = true ]) : string
Parameters
- $row : array<string|int, mixed>
-
Input must be a page row ($row) with the proper fields set (be sure - send the full range of fields for the table)
- $perms_clause : string = ''
-
This is used to get the record path of the shortcut page, if any (and doktype==4)
- $includeAttrib : bool = true
-
If $includeAttrib is set, then the 'title=""' attribute is wrapped about the return value, which is in any case htmlspecialchar()'ed already
Return values
stringtranslationCount()
Counting translations of records
public static translationCount(string $table, string $ref[, string $msg = '' ]) : string
Parameters
- $table : string
-
Table name
- $ref : string
-
Reference: the record's uid
- $msg : string = ''
-
Message with %s, eg. "This record has %s translation(s) which will be deleted, too!
Return values
string —Output string (or int count value if no msg string specified)
viewOnClick()
Returns a JavaScript string for viewing the page id, $id It will re-use any window already open.
public static viewOnClick(int $pageUid[, string $backPath = '' ][, array<string|int, mixed>|null $rootLine = null ][, string $anchorSection = '' ][, string $alternativeUrl = '' ][, string $additionalGetVars = '' ][, bool $switchFocus = true ]) : string
Deprecated Use TYPO3\CMS\Backend\Routing\PreviewUriBuilder instead, will be removed in TYPO3 v12.0
Parameters
- $pageUid : int
-
Page UID
- $backPath : string = ''
-
Must point back to TYPO3_mainDir (where the site is assumed to be one level above)
- $rootLine : array<string|int, mixed>|null = null
-
If root line is supplied the function will look for the first found domain record and use that URL instead (if found)
- $anchorSection : string = ''
-
Optional anchor to the URL
- $alternativeUrl : string = ''
-
An alternative URL that, if set, will ignore other parameters except $switchFocus: It will return the window.open command wrapped around this URL!
- $additionalGetVars : string = ''
-
Additional GET variables.
- $switchFocus : bool = true
-
If TRUE, then the preview window will gain the focus.
Return values
stringworkspaceOL()
Workspace Preview Overlay.
public static workspaceOL(string $table, array<string|int, mixed> &$row[, int $wsid = -99 ][, bool $unsetMovePointers = false ]) : mixed
Generally ALWAYS used when records are selected based on uid or pid. Principle; Record online! => Find offline? The function MAY set $row to FALSE. This happens if a moved record is given and $unsetMovePointers is set to true. In other words, you should check if the input record is still an array afterwards when using this function.
If the versioned record is a moved record the "pid" value will then contain the newly moved location and "ORIG_pid" will contain the live pid.
Parameters
- $table : string
-
Table name
- $row : array<string|int, mixed>
-
Record by reference. At least "uid", "pid", "t3ver_oid" and "t3ver_state" must be set. Keys not prefixed with '_' are used as field names in SQL.
- $wsid : int = -99
-
Workspace ID, if not specified will use static::getBackendUserAuthentication()->workspace
- $unsetMovePointers : bool = false
-
If TRUE the function does not return a "pointer" row for moved records in a workspace
Tags
wrapClickMenuOnIcon()
Makes click menu link (context sensitive menu)
public static wrapClickMenuOnIcon(string $content, string $table[, int|string $uid = 0 ][, string $context = '' ][, string $_addParams = '' ][, string $_enDisItems = '' ][, bool $returnTagParameters = false ]) : string|array<string|int, mixed>
Returns $str wrapped in a link which will activate the context sensitive menu for the record ($table/$uid) or file ($table = file) The link will load the top frame with the parameter "&item" which is the table, uid and context arguments imploded by "|": rawurlencode($table.'|'.$uid.'|'.$context)
Parameters
- $content : string
-
String to be wrapped in link, typ. image tag.
- $table : string
-
Table name/File path. If the icon is for a database record, enter the tablename from $GLOBALS['TCA']. If a file then enter the absolute filepath
- $uid : int|string = 0
-
If icon is for database record this is the UID for the record from $table or identifier for sys_file record
- $context : string = ''
-
Set tree if menu is called from tree view
- $_addParams : string = ''
-
NOT IN USE Deprecated since TYPO3 11, will be removed in TYPO3 12.
- $_enDisItems : string = ''
-
NOT IN USE Deprecated since TYPO3 11, will be removed in TYPO3 12.
- $returnTagParameters : bool = false
-
If set, will return only the onclick JavaScript, not the whole link. Deprecated since TYPO3 11, will be removed in TYPO3 12.
Return values
string|array<string|int, mixed> —The link wrapped input string.
wrapInHelp()
API function that wraps the text / html in help text, so if a user hovers over it the help text will show up
public static wrapInHelp(string $table, string $field[, string $text = '' ][, array<string|int, mixed> $overloadHelpText = [] ]) : string
Parameters
- $table : string
-
The table name for which the help should be shown
- $field : string
-
The field name for which the help should be shown
- $text : string = ''
-
The text which should be wrapped with the help text
- $overloadHelpText : array<string|int, mixed> = []
-
Array with text to overload help text
Internal should only be used from within TYPO3 Core
Return values
string —the HTML code ready to render
wsMapId()
Performs mapping of new uids to new versions UID in case of import inside a workspace.
public static wsMapId(string $table, int $uid) : int
Parameters
- $table : string
-
Table name
- $uid : int
-
Record uid (of live record placeholder)
Internal should only be used from within TYPO3 Core
Return values
int —Uid of offline version if any, otherwise live uid.
buildScriptUrl()
Builds the URL to the current script with given arguments
protected static buildScriptUrl(mixed $mainParams, string $addParams[, string $script = '' ]) : string
Parameters
- $mainParams : mixed
-
$id is the "&id=" parameter value to be sent to the module, but it can be also a parameter array which will be passed instead of the &id=...
- $addParams : string
-
Additional parameters to pass to the script.
- $script : string = ''
-
The script to send the &id to, if empty it's automatically found
Tags
Return values
string —The complete script URL
getBackendUserAuthentication()
protected static getBackendUserAuthentication() : BackendUserAuthentication|null
Return values
BackendUserAuthentication|nullgetConnectionForTable()
protected static getConnectionForTable(string $table) : Connection
Parameters
- $table : string
Return values
ConnectiongetLanguageService()
protected static getLanguageService() : LanguageService
Return values
LanguageServicegetLogger()
protected static getLogger() : LoggerInterface
Return values
LoggerInterfacegetPageForRootline()
Gets the cached page record for the rootline
protected static getPageForRootline(int $uid, string $clause, bool $workspaceOL[, array<string|int, string> $additionalFields = [] ]) : array<string|int, mixed>
Parameters
- $uid : int
-
Page id for which to create the root line.
- $clause : string
-
Clause can be used to select other criteria. It would typically be where-clauses that stops the process if we meet a page, the user has no reading access to.
- $workspaceOL : bool
-
If TRUE, version overlay is applied. This must be requested specifically because it is usually only wanted when the rootline is used for visual output while for permission checking you want the raw thing!
- $additionalFields : array<string|int, string> = []
-
AdditionalFields to fetch from the root line
Tags
Return values
array<string|int, mixed> —Cached page record for the rootline
getQueryBuilderForTable()
protected static getQueryBuilderForTable(string $table) : QueryBuilder
Parameters
- $table : string
Return values
QueryBuildergetRecordsSortedByTitle()
Returns an array of all non-deleted records of a table sorted by a given title field.
protected static getRecordsSortedByTitle(array<string|int, mixed> $fields, string $table, string $titleField[, string $where = '' ]) : array<string|int, mixed>
The value of the title field will be replaced by the return value of self::getRecordTitle() before the sorting is performed.
Parameters
- $fields : array<string|int, mixed>
-
Fields to select
- $table : string
-
Table name
- $titleField : string
-
Field that will contain the record title
- $where : string = ''
-
Additional where clause
Return values
array<string|int, mixed> —Array of sorted records
getRuntimeCache()
Gets an instance of the runtime cache.
protected static getRuntimeCache() : FrontendInterface
Return values
FrontendInterfaceresolveRelationLabels()
Helper method to fetch all labels for all relations of processed Values.
protected static resolveRelationLabels(array<string|int, mixed> $theColConf, string $table, string|int|null $recordId, string|int $value, bool $noRecordLookup) : array<string|int, mixed>
Parameters
- $theColConf : array<string|int, mixed>
- $table : string
- $recordId : string|int|null
- $value : string|int
- $noRecordLookup : bool
Return values
array<string|int, mixed>Search results