Clipboard

TYPO3 clipboard for records and files

Internal

This class is a specific Backend implementation and is not considered part of the Public TYPO3 API.

Table of Contents

Properties

$changed  : bool
$clipData  : array<string|int, mixed>
Clipboard data kept here
$current  : string
$lockToNormal  : bool
$numberOfPads  : int
$iconFactory  : IconFactory
$request  : ServerRequestInterface|null
$resourceFactory  : ResourceFactory
$uriBuilder  : UriBuilder

Methods

__construct()  : mixed
cleanCurrent()  : void
This traverses the elements on the current clipboard pane and unsets elements which does not exist anymore or are disabled.
cleanUpCBC()  : array<string|int, mixed>
Cleans up an incoming element array $CBarr (Array selecting/deselecting elements)
confirmMsgText()  : string
Returns confirm JavaScript message
currentMode()  : string
Returns the current mode, 'copy' or 'cut'
elFromTable()  : array<string|int, mixed>
Counts the number of elements from the table $matchTable. If $matchTable is blank, all tables (except '_FILE' of course) is counted.
endClipboard()  : void
Call this after initialization and setCmd in order to save the clipboard to the user session.
getClipboardData()  : array<string|int, mixed>
getSelectedRecord()  : array<string|int, mixed>
Returns the first element on the current clipboard Makes sense only for DB records - not files!
hasElements()  : bool
Returns true if the clipboard contains elements
initializeClipboard()  : void
Initialize the clipboard from the be_user session
isSelected()  : string
Verifies if the item $table/$uid is on the current pad.
lockToNormal()  : void
Call this method after initialization if you want to lock the clipboard to operate on the normal pad only.
pasteUrl()  : string
pasteUrl of the element (database and file) For the meaning of $table and $uid, please read from ->makePasteCmdArray!!! The URL will point to tce_file or tce_db depending in $table
printClipboard()  : string
removeElement()  : void
Removes element on clipboard
selUrlDB()  : string
Returns the select-url for database elements
selUrlFile()  : string
Returns the select-url for files
setCmd()  : void
The array $cmd may hold various keys which notes some action to take.
setCurrentPad()  : void
Setting the current pad on clipboard
buildUrl()  : string
Builds a URL to the current module with the received parameters, merged / replaced by additional parameters.
clipboardLabel()  : string
Clipboard label - getting from "EXT:core/Resources/Private/Language/locallang_core.xlf:"
getBackendUser()  : BackendUserAuthentication
Returns the current BE user.
getLanguageService()  : LanguageService
Returns LanguageService
getLocalizations()  : array<string|int, mixed>
Gets all localizations of the current record.
getTabInfo()  : string
Additional information for the tab. This is either the current copyMode (for "normal") or the elements count, for numeric tabs. Latter will not be shown, in case no elements exist for the tab.
getTabItems()  : array<string|int, mixed>
Get the items for the given pad identifier
isElements()  : bool
Reports if the current pad has elements (does not check file/DB type OR if file/DBrecord exists or not. Only counting array)
linkItemText()  : string
Wraps the title of the element in a link to the page/folder where they originate from.
saveClipboard()  : void
Saves the clipboard, no questions asked.

Properties

$clipData

Clipboard data kept here

public array<string|int, mixed> $clipData = []

Keys: 'normal' 'tab_[x]' where x is >=1 and denotes the pad-number 'mode' : 'copy' means copy-mode, default = moving ('cut') 'el' : Array of elements: DB: keys = '[tablename]|[uid]' eg. 'tt_content:123' DB: values = 1 (basically insignificant) FILE: keys = '_FILE|[md5 of path]' eg. '_FILE|9ebc7e5c74' FILE: values = The full filepath, eg. '/www/htdocs/typo3/32/dummy/fileadmin/sem1_3_examples/alternative_index.php' or 'C:/www/htdocs/typo3/32/dummy/fileadmin/sem1_3_examples/alternative_index.php'

'current' pointer to current tab (among the above...)

The virtual tablename '_FILE' will always indicate files/folders. When checking for elements from eg. 'all tables' (by using an empty string) '_FILE' entries are excluded (so in effect only DB elements are counted)

$lockToNormal

public bool $lockToNormal = false

$request

protected ServerRequestInterface|null $request = null

Methods

cleanCurrent()

This traverses the elements on the current clipboard pane and unsets elements which does not exist anymore or are disabled.

public cleanCurrent() : void

cleanUpCBC()

Cleans up an incoming element array $CBarr (Array selecting/deselecting elements)

public cleanUpCBC(array<string|int, mixed> $CBarr, string $table[, bool $removeDeselected = false ]) : array<string|int, mixed>
Parameters
$CBarr : array<string|int, mixed>

Element array from outside ("key" => "selected/deselected")

$table : string

The 'table which is allowed'. Must be set.

$removeDeselected : bool = false

Can be set in order to remove entries which are marked for deselection.

Return values
array<string|int, mixed>

Processed input $CBarr

confirmMsgText()

Returns confirm JavaScript message

public confirmMsgText(string $table, array<string|int, mixed>|string $reference, string $type, array<string|int, mixed> $selectedElements[, string $columnLabel = '' ]) : string
Parameters
$table : string

Table name

$reference : array<string|int, mixed>|string

For records its an array, for files its a string (path)

$type : string

Type-code

$selectedElements : array<string|int, mixed>

Array of selected elements

$columnLabel : string = ''

Name of the content column

Return values
string

the text for a confirm message

currentMode()

Returns the current mode, 'copy' or 'cut'

public currentMode() : string
Return values
string

"copy" or "cut

elFromTable()

Counts the number of elements from the table $matchTable. If $matchTable is blank, all tables (except '_FILE' of course) is counted.

public elFromTable([string $matchTable = '' ][, string $padIdentifier = '' ]) : array<string|int, mixed>
Parameters
$matchTable : string = ''

Table to match/count for.

$padIdentifier : string = ''

Can optionally be used to set another pad than the current.

Return values
array<string|int, mixed>

Array with keys from the CB.

endClipboard()

Call this after initialization and setCmd in order to save the clipboard to the user session.

public endClipboard() : void

The function will check if the internal flag ->changed has been set and if so, save the clipboard. Else not.

getClipboardData()

public getClipboardData([string $table = '' ]) : array<string|int, mixed>
Parameters
$table : string = ''
Return values
array<string|int, mixed>

getSelectedRecord()

Returns the first element on the current clipboard Makes sense only for DB records - not files!

public getSelectedRecord() : array<string|int, mixed>
Return values
array<string|int, mixed>

Element record with extra field _RECORD_TITLE set to the title of the record

hasElements()

Returns true if the clipboard contains elements

public hasElements() : bool
Return values
bool

initializeClipboard()

Initialize the clipboard from the be_user session

public initializeClipboard([ServerRequestInterface|null $request = null ]) : void
Parameters
$request : ServerRequestInterface|null = null

isSelected()

Verifies if the item $table/$uid is on the current pad.

public isSelected(string $table, string|int $identifier) : string

If the pad is "normal" and the element exists, the mode value is returned. Thus you'll know if the item was copied or cut.

Parameters
$table : string

Table name, (_FILE for files...)

$identifier : string|int

Either the records' uid or a filepath

Return values
string

If selected the current mode is returned, otherwise an empty string

lockToNormal()

Call this method after initialization if you want to lock the clipboard to operate on the normal pad only.

public lockToNormal() : void

Trying to switch pad through ->setCmd will not work. This is used by the clickmenu since it only allows operation on single elements at a time (that is the "normal" pad)

pasteUrl()

pasteUrl of the element (database and file) For the meaning of $table and $uid, please read from ->makePasteCmdArray!!! The URL will point to tce_file or tce_db depending in $table

public pasteUrl(string $table, string|int $identifier[, bool $setRedirect = true ][, array<string|int, mixed>|null $update = null ]) : string
Parameters
$table : string

Tablename (_FILE for files)

$identifier : string|int

"destination": can be positive or negative indicating how the paste is done (paste into / paste after). For files, this is the combined identifier.

$setRedirect : bool = true

If set, then the redirect URL will point back to the current script, but with CB reset.

$update : array<string|int, mixed>|null = null

Additional key/value pairs which should get set in the moved/copied record (via DataHandler)

Return values
string

printClipboard()

public printClipboard([string $table = '' ]) : string
Deprecated

Backwards compatibility for some extensions. Will be removed in v12.

Parameters
$table : string = ''
Return values
string

removeElement()

Removes element on clipboard

public removeElement(string $elementKey) : void
Parameters
$elementKey : string

Key of element in ->clipData array

selUrlDB()

Returns the select-url for database elements

public selUrlDB(string $table, int $uid[, bool $copy = false ][, bool $deselect = false ]) : string
Parameters
$table : string

Table name

$uid : int

Uid of record

$copy : bool = false

If set, copymode will be enabled

$deselect : bool = false

If set, the link will deselect, otherwise select.

Return values
string

URL linking to the current script but with the CB array set to select the element with table/uid

selUrlFile()

Returns the select-url for files

public selUrlFile(string $path[, bool $copy = false ][, bool $deselect = false ]) : string
Parameters
$path : string

Filepath

$copy : bool = false

If set, copymode will be enabled

$deselect : bool = false

If set, the link will deselect, otherwise select.

Return values
string

URL linking to the current script but with the CB array set to select the path

setCmd()

The array $cmd may hold various keys which notes some action to take.

public setCmd(array<string|int, mixed> $cmd) : void

Normally perform only one action at a time. In scripts like db_list.php / filelist/mod1/index.php the GET-var CB is used to control the clipboard.

Selecting / Deselecting elements Array $cmd['el'] has keys = element-ident, value = element value (see description of clipData array in header) Selecting elements for 'copy' should be done by simultaneously setting setCopyMode.

Parameters
$cmd : array<string|int, mixed>

Array of actions, see function description

setCurrentPad()

Setting the current pad on clipboard

public setCurrentPad(string $padIdentifier) : void
Parameters
$padIdentifier : string

Key in the array $this->clipData

buildUrl()

Builds a URL to the current module with the received parameters, merged / replaced by additional parameters.

protected buildUrl([array<string|int, mixed> $parameters = [] ]) : string
Parameters
$parameters : array<string|int, mixed> = []
Return values
string

clipboardLabel()

Clipboard label - getting from "EXT:core/Resources/Private/Language/locallang_core.xlf:"

protected clipboardLabel(string $key) : string
Parameters
$key : string

Label Key

Return values
string

htmspecialchared' label

getLocalizations()

Gets all localizations of the current record.

protected getLocalizations(string $table, array<string|int, mixed> $parentRecord, bool $isRequestedTable) : array<string|int, mixed>
Parameters
$table : string

The table

$parentRecord : array<string|int, mixed>

The parent record

$isRequestedTable : bool

Whether the element is from the requested table

Return values
array<string|int, mixed>

HTML table rows

getTabInfo()

Additional information for the tab. This is either the current copyMode (for "normal") or the elements count, for numeric tabs. Latter will not be shown, in case no elements exist for the tab.

protected getTabInfo(string $padIdentifier[, string $table = '' ]) : string
Parameters
$padIdentifier : string

Identifier for the clipboard pad

$table : string = ''

The table name to count for elements

Return values
string

getTabItems()

Get the items for the given pad identifier

protected getTabItems(string $padIdentifier, string $currentTable) : array<string|int, mixed>
Parameters
$padIdentifier : string

Pad reference

$currentTable : string
Return values
array<string|int, mixed>

The tab items

isElements()

Reports if the current pad has elements (does not check file/DB type OR if file/DBrecord exists or not. Only counting array)

protected isElements() : bool
Return values
bool

TRUE if elements exist.

linkItemText()

Wraps the title of the element in a link to the page/folder where they originate from.

protected linkItemText(string $itemText, array<string|int, mixed>|string $reference, bool $isRequestedTable) : string

Will be wrapped into "muted" style in case the element is not from the currently requested table.

Parameters
$itemText : string

Title of element - must be htmlspecialchar'ed on beforehand.

$reference : array<string|int, mixed>|string

If array, a record is expected. If string, its the folders' combined identifier

$isRequestedTable : bool

Whether the element is from the requested table

Return values
string

saveClipboard()

Saves the clipboard, no questions asked.

protected saveClipboard() : void

Use ->endClipboard normally (as it checks if changes has been done so saving is necessary)


        
On this page

Search results