‪TYPO3CMS  10.4
TYPO3\CMS\Backend\Clipboard\Clipboard Class Reference

Public Member Functions

 __construct ()
 
 initializeClipboard ()
 
 lockToNormal ()
 
 setCmd ($cmd)
 
 setCurrentPad ($padIdent)
 
 endClipboard ()
 
array cleanUpCBC ($CBarr, $table, $removeDeselected=0)
 
string printClipboard ()
 
array getContentFromTab ($pad)
 
bool hasElements ()
 
array getLocalizations ($table, $parentRec)
 
string padTitle ($pad)
 
string linkItemText ($str, $rec, $table='')
 
string selUrlDB ($table, $uid, $copy=0, $deselect=0, $baseArray=[])
 
string selUrlFile ($path, $copy=0, $deselect=0, $baseArray=[])
 
string pasteUrl ($table, $uid, $setRedirect=true, array $update=null)
 
string deleteUrl ($setRedirect=true, $file=false)
 
string editUrl ()
 
string removeUrl ($table, $uid)
 
string confirmMsgText ($table, $rec, $type, $clElements, $columnLabel='')
 
string clLabel ($key, $Akey='labels')
 
 removeElement ($el)
 
 saveClipboard ()
 
string currentMode ()
 
 cleanCurrent ()
 
array elFromTable ($matchTable='', $pad='')
 
string isSelected ($table, $uid)
 
array getSelectedRecord ($table='', $uid='')
 
bool isElements ()
 
array makePasteCmdArray ($ref, $CMD, array $update=null)
 
array makeDeleteCmdArray ($CMD)
 
array makePasteCmdArray_file ($ref, $FILE)
 
array makeDeleteCmdArray_file ($FILE)
 

Public Attributes

int $numberTabs = 3
 
array $clipData = array( )
 
int $changed = 0
 
string $current = ''
 
int $lockToNormal = 0
 
bool $fileMode = false
 

Protected Member Functions

array exportClipElementParameters ()
 
TYPO3 CMS Core Localization LanguageService getLanguageService ()
 
TYPO3 CMS Core Authentication BackendUserAuthentication getBackendUser ()
 
StandaloneView getStandaloneView ()
 

Protected Attributes

IconFactory $iconFactory
 
StandaloneView $view
 

Detailed Description

TYPO3 clipboard for records and files

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

Definition at line 42 of file Clipboard.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Backend\Clipboard\Clipboard::__construct ( )

Construct

Exceptions

Definition at line 101 of file Clipboard.php.

References TYPO3\CMS\Backend\Clipboard\Clipboard\getStandaloneView().

Member Function Documentation

◆ cleanCurrent()

TYPO3\CMS\Backend\Clipboard\Clipboard::cleanCurrent ( )

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

Definition at line 820 of file Clipboard.php.

References TYPO3\CMS\Backend\Utility\BackendUtility\getRecord().

Referenced by TYPO3\CMS\Backend\ContextMenu\ItemProviders\AbstractProvider\initClipboard().

◆ cleanUpCBC()

array TYPO3\CMS\Backend\Clipboard\Clipboard::cleanUpCBC (   $CBarr,
  $table,
  $removeDeselected = 0 
)

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

Parameters
array$CBarr‪Element array from outside ("key" => "selected/deselected")
string$table‪The 'table which is allowed'. Must be set.
bool | int$removeDeselected‪Can be set in order to remove entries which are marked for deselection.
Returns
‪array Processed input $CBarr

Definition at line 228 of file Clipboard.php.

◆ clLabel()

string TYPO3\CMS\Backend\Clipboard\Clipboard::clLabel (   $key,
  $Akey = 'labels' 
)

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

Parameters
string$key‪Label Key
string$Akey‪Alternative key to "labels
Returns
‪string

Definition at line 740 of file Clipboard.php.

References TYPO3\CMS\Backend\Clipboard\Clipboard\getLanguageService().

Referenced by TYPO3\CMS\Backend\Clipboard\Clipboard\padTitle(), and TYPO3\CMS\Backend\Clipboard\Clipboard\printClipboard().

◆ confirmMsgText()

string TYPO3\CMS\Backend\Clipboard\Clipboard::confirmMsgText (   $table,
  $rec,
  $type,
  $clElements,
  $columnLabel = '' 
)

Returns confirm JavaScript message

Parameters
string$table‪Table name
mixed$rec‪For records its an array, for files its a string (path)
string$type‪Type-code
array$clElements‪Array of selected elements
string$columnLabel‪Name of the content column
Returns
‪string the text for a confirm message

Definition at line 690 of file Clipboard.php.

References $GLOBALS, TYPO3\CMS\Core\Utility\PathUtility\basename(), TYPO3\CMS\Core\Type\Bitmask\JsConfirmation\COPY_MOVE_PASTE, TYPO3\CMS\Backend\Clipboard\Clipboard\currentMode(), TYPO3\CMS\Backend\Clipboard\Clipboard\getBackendUser(), TYPO3\CMS\Backend\Clipboard\Clipboard\getLanguageService(), TYPO3\CMS\Backend\Utility\BackendUtility\getRecordTitle(), and TYPO3\CMS\Backend\Clipboard\Clipboard\getSelectedRecord().

◆ currentMode()

◆ deleteUrl()

string TYPO3\CMS\Backend\Clipboard\Clipboard::deleteUrl (   $setRedirect = true,
  $file = false 
)

deleteUrl for current pad

Parameters
bool$setRedirect‪If set, then the redirect URL will point back to the current script, but with CB reset.
bool$file‪If set, then the URL will link to the tce_file.php script in the typo3/ dir.
Returns
‪string

Definition at line 634 of file Clipboard.php.

References TYPO3\CMS\Backend\Clipboard\Clipboard\$current.

Referenced by TYPO3\CMS\Backend\Clipboard\Clipboard\printClipboard().

◆ editUrl()

string TYPO3\CMS\Backend\Clipboard\Clipboard::editUrl ( )

editUrl of all current elements ONLY database Links to FormEngine

Returns
‪string The URL to FormEngine with parameters.

Definition at line 654 of file Clipboard.php.

References TYPO3\CMS\Backend\Clipboard\Clipboard\elFromTable().

Referenced by TYPO3\CMS\Backend\Clipboard\Clipboard\printClipboard().

◆ elFromTable()

array TYPO3\CMS\Backend\Clipboard\Clipboard::elFromTable (   $matchTable = '',
  $pad = '' 
)

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

Parameters
string$matchTable‪Table to match/count for.
string$pad‪Can optionally be used to set another pad than the current.
Returns
‪array Array with keys from the CB.

Definition at line 854 of file Clipboard.php.

References TYPO3\CMS\Backend\Clipboard\Clipboard\$current, and $GLOBALS.

Referenced by TYPO3\CMS\Backend\Clipboard\Clipboard\editUrl(), TYPO3\CMS\Backend\Clipboard\Clipboard\getSelectedRecord(), TYPO3\CMS\Backend\Clipboard\Clipboard\makeDeleteCmdArray(), TYPO3\CMS\Backend\Clipboard\Clipboard\makeDeleteCmdArray_file(), TYPO3\CMS\Backend\Clipboard\Clipboard\makePasteCmdArray(), TYPO3\CMS\Backend\Clipboard\Clipboard\makePasteCmdArray_file(), TYPO3\CMS\Backend\Clipboard\Clipboard\padTitle(), and TYPO3\CMS\Backend\Clipboard\Clipboard\printClipboard().

◆ endClipboard()

TYPO3\CMS\Backend\Clipboard\Clipboard::endClipboard ( )

◆ exportClipElementParameters()

array TYPO3\CMS\Backend\Clipboard\Clipboard::exportClipElementParameters ( )
protected

Creates GET parameters for linking to the export module.

Returns
‪array GET parameters for current clipboard content to be exported

Definition at line 750 of file Clipboard.php.

References TYPO3\CMS\Backend\Clipboard\Clipboard\$current, and TYPO3\CMS\Backend\Utility\BackendUtility\getRecord().

Referenced by TYPO3\CMS\Backend\Clipboard\Clipboard\printClipboard().

◆ getBackendUser()

TYPO3 CMS Core Authentication BackendUserAuthentication TYPO3\CMS\Backend\Clipboard\Clipboard::getBackendUser ( )
protected

◆ getContentFromTab()

◆ getLanguageService()

TYPO3 CMS Core Localization LanguageService TYPO3\CMS\Backend\Clipboard\Clipboard::getLanguageService ( )
protected

Returns LanguageService

Returns
‪\TYPO3\CMS\Core\Localization\LanguageService

Definition at line 1052 of file Clipboard.php.

References $GLOBALS.

Referenced by TYPO3\CMS\Backend\Clipboard\Clipboard\clLabel(), TYPO3\CMS\Backend\Clipboard\Clipboard\confirmMsgText(), and TYPO3\CMS\Backend\Clipboard\Clipboard\printClipboard().

◆ getLocalizations()

array TYPO3\CMS\Backend\Clipboard\Clipboard::getLocalizations (   $table,
  $parentRec 
)

◆ getSelectedRecord()

array TYPO3\CMS\Backend\Clipboard\Clipboard::getSelectedRecord (   $table = '',
  $uid = '' 
)

Returns item record $table,$uid if selected on current clipboard If table and uid is blank, the first element is returned. Makes sense only for DB records - not files!

Parameters
string$table‪Table name
int | string$uid‪Element uid
Returns
‪array Element record with extra field _RECORD_TITLE set to the title of the record

Definition at line 900 of file Clipboard.php.

References TYPO3\CMS\Backend\Clipboard\Clipboard\elFromTable(), TYPO3\CMS\Backend\Utility\BackendUtility\getRecordTitle(), TYPO3\CMS\Backend\Utility\BackendUtility\getRecordWSOL(), and TYPO3\CMS\Backend\Clipboard\Clipboard\isSelected().

Referenced by TYPO3\CMS\Backend\Clipboard\Clipboard\confirmMsgText().

◆ getStandaloneView()

◆ hasElements()

bool TYPO3\CMS\Backend\Clipboard\Clipboard::hasElements ( )

Returns true if the clipboard contains elements

Returns
‪bool

Definition at line 452 of file Clipboard.php.

◆ initializeClipboard()

◆ isElements()

bool TYPO3\CMS\Backend\Clipboard\Clipboard::isElements ( )

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

Returns
‪bool TRUE if elements exist.

Definition at line 920 of file Clipboard.php.

Referenced by TYPO3\CMS\Backend\Clipboard\Clipboard\setCurrentPad().

◆ isSelected()

string TYPO3\CMS\Backend\Clipboard\Clipboard::isSelected (   $table,
  $uid 
)

Verifies if the item $table/$uid is on the current pad. 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
string$table‪Table name, (_FILE for files...)
int$uid‪Element uid (path for files)
Returns
‪string

Definition at line 885 of file Clipboard.php.

References TYPO3\CMS\Backend\Clipboard\Clipboard\currentMode().

Referenced by TYPO3\CMS\Backend\Clipboard\Clipboard\getSelectedRecord().

◆ linkItemText()

string TYPO3\CMS\Backend\Clipboard\Clipboard::linkItemText (   $str,
  $rec,
  $table = '' 
)

Wraps the title of the items listed in link-tags. The items will link to the page/folder where they originate from

Parameters
string$str‪Title of element - must be htmlspecialchar'ed on beforehand.
mixed$rec‪If array, a record is expected. If string, its a path
string$table‪Table name
Returns
‪string

Definition at line 542 of file Clipboard.php.

References TYPO3\CMS\Core\Utility\PathUtility\dirname(), and TYPO3\CMS\Core\Utility\ExtensionManagementUtility\isLoaded().

Referenced by TYPO3\CMS\Backend\Clipboard\Clipboard\getContentFromTab().

◆ lockToNormal()

TYPO3\CMS\Backend\Clipboard\Clipboard::lockToNormal ( )

Call this method after initialization if you want to lock the clipboard to operate on the normal pad only. 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)

Definition at line 135 of file Clipboard.php.

Referenced by TYPO3\CMS\Backend\ContextMenu\ItemProviders\AbstractProvider\initClipboard(), and TYPO3\CMS\Backend\Clipboard\Clipboard\setCurrentPad().

◆ makeDeleteCmdArray()

array TYPO3\CMS\Backend\Clipboard\Clipboard::makeDeleteCmdArray (   $CMD)

Delete record entries in CMD array

Parameters
array$CMD‪Command-array
Returns
‪array Modified Command-array

Definition at line 984 of file Clipboard.php.

References TYPO3\CMS\Backend\Clipboard\Clipboard\elFromTable(), TYPO3\CMS\Backend\Clipboard\Clipboard\endClipboard(), and TYPO3\CMS\Backend\Clipboard\Clipboard\removeElement().

◆ makeDeleteCmdArray_file()

array TYPO3\CMS\Backend\Clipboard\Clipboard::makeDeleteCmdArray_file (   $FILE)

Delete files in CMD array

Parameters
array$FILE‪Command-array
Returns
‪array Modified Command-array

Definition at line 1035 of file Clipboard.php.

References TYPO3\CMS\Backend\Clipboard\Clipboard\elFromTable(), TYPO3\CMS\Backend\Clipboard\Clipboard\endClipboard(), and TYPO3\CMS\Backend\Clipboard\Clipboard\removeElement().

◆ makePasteCmdArray()

array TYPO3\CMS\Backend\Clipboard\Clipboard::makePasteCmdArray (   $ref,
  $CMD,
array  $update = null 
)

Applies the proper paste configuration in the $cmd array send to SimpleDataHandlerController (tce_db route) $ref is the target, see description below. The current pad is pasted

$ref: [tablename]:[paste-uid]. Tablename is the name of the table from which elements on the current clipboard is pasted with the 'pid' paste-uid. No tablename means that all items on the clipboard (non-files) are pasted. This requires paste-uid to be positive though. so 'tt_content:-3' means 'paste tt_content elements on the clipboard to AFTER tt_content:3 record 'tt_content:30' means 'paste tt_content elements on the clipboard into page with id 30 ':30' means 'paste ALL database elements on the clipboard into page with id 30 ':-30' not valid.

Parameters
string$ref‪[tablename]:[paste-uid], see description
array$CMD‪Command-array
array | null$update‪If additional values should get set in the copied/moved record this will be an array containing key=>value pairs
Returns
‪array Modified Command-array

Definition at line 943 of file Clipboard.php.

References TYPO3\CMS\Backend\Clipboard\Clipboard\currentMode(), TYPO3\CMS\Backend\Clipboard\Clipboard\elFromTable(), TYPO3\CMS\Backend\Clipboard\Clipboard\endClipboard(), and TYPO3\CMS\Backend\Clipboard\Clipboard\removeElement().

◆ makePasteCmdArray_file()

array TYPO3\CMS\Backend\Clipboard\Clipboard::makePasteCmdArray_file (   $ref,
  $FILE 
)

Applies the proper paste configuration in the $file array send to tce_file.php. The current pad is pasted

Parameters
string$ref‪Reference to element (splitted by "|")
array$FILE‪Command-array
Returns
‪array Modified Command-array

Definition at line 1013 of file Clipboard.php.

References TYPO3\CMS\Backend\Clipboard\Clipboard\currentMode(), TYPO3\CMS\Backend\Clipboard\Clipboard\elFromTable(), TYPO3\CMS\Backend\Clipboard\Clipboard\endClipboard(), and TYPO3\CMS\Backend\Clipboard\Clipboard\removeElement().

◆ padTitle()

string TYPO3\CMS\Backend\Clipboard\Clipboard::padTitle (   $pad)

Warps title with number of elements if any.

Parameters
string$pad‪Pad reference
Returns
‪string padding

Definition at line 525 of file Clipboard.php.

References TYPO3\CMS\Backend\Clipboard\Clipboard\clLabel(), and TYPO3\CMS\Backend\Clipboard\Clipboard\elFromTable().

Referenced by TYPO3\CMS\Backend\Clipboard\Clipboard\printClipboard().

◆ pasteUrl()

string TYPO3\CMS\Backend\Clipboard\Clipboard::pasteUrl (   $table,
  $uid,
  $setRedirect = true,
array  $update = null 
)

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

Parameters
string$table‪Tablename (_FILE for files)
mixed$uid‪"destination": can be positive or negative indicating how the paste is done (paste into / paste after)
bool$setRedirect‪If set, then the redirect URL will point back to the current script, but with CB reset.
array | null$update‪Additional key/value pairs which should get set in the moved/copied record (via DataHandler)
Returns
‪string

Definition at line 611 of file Clipboard.php.

References TYPO3\CMS\Backend\Clipboard\Clipboard\$current.

◆ printClipboard()

◆ removeElement()

TYPO3\CMS\Backend\Clipboard\Clipboard::removeElement (   $el)

◆ removeUrl()

string TYPO3\CMS\Backend\Clipboard\Clipboard::removeUrl (   $table,
  $uid 
)

Returns the remove-url (file and db) for file $table='_FILE' and $uid = shortmd5 hash of path

Parameters
string$table‪Tablename
string$uid‪Uid integer/shortmd5 hash
Returns
‪string URL

Definition at line 675 of file Clipboard.php.

Referenced by TYPO3\CMS\Backend\Clipboard\Clipboard\getContentFromTab().

◆ saveClipboard()

TYPO3\CMS\Backend\Clipboard\Clipboard::saveClipboard ( )

Saves the clipboard, no questions asked. Use ->endClipboard normally (as it checks if changes has been done so saving is necessary)

Definition at line 801 of file Clipboard.php.

References TYPO3\CMS\Backend\Clipboard\Clipboard\getBackendUser(), and TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\pushModuleData().

Referenced by TYPO3\CMS\Backend\Clipboard\Clipboard\endClipboard().

◆ selUrlDB()

string TYPO3\CMS\Backend\Clipboard\Clipboard::selUrlDB (   $table,
  $uid,
  $copy = 0,
  $deselect = 0,
  $baseArray = [] 
)

Returns the select-url for database elements

Parameters
string$table‪Table name
int$uid‪Uid of record
bool | int$copy‪If set, copymode will be enabled
bool | int$deselect‪If set, the link will deselect, otherwise select.
array$baseArray‪The base array of GET vars to be sent in addition. Notice that current GET vars WILL automatically be included.
Returns
‪string URL linking to the current script but with the CB array set to select the element with table/uid

Definition at line 571 of file Clipboard.php.

◆ selUrlFile()

string TYPO3\CMS\Backend\Clipboard\Clipboard::selUrlFile (   $path,
  $copy = 0,
  $deselect = 0,
  $baseArray = [] 
)

Returns the select-url for files

Parameters
string$path‪Filepath
bool | int$copy‪If set, copymode will be enabled
bool | int$deselect‪If set, the link will deselect, otherwise select.
array$baseArray‪The base array of GET vars to be sent in addition. Notice that current GET vars WILL automatically be included.
Returns
‪string URL linking to the current script but with the CB array set to select the path

Definition at line 590 of file Clipboard.php.

◆ setCmd()

TYPO3\CMS\Backend\Clipboard\Clipboard::setCmd (   $cmd)

The array $cmd may hold various keys which notes some action to take. 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
array$cmd‪Array of actions, see function description

Definition at line 152 of file Clipboard.php.

References TYPO3\CMS\Backend\Clipboard\Clipboard\$current, TYPO3\CMS\Backend\Clipboard\Clipboard\removeElement(), and TYPO3\CMS\Backend\Clipboard\Clipboard\setCurrentPad().

◆ setCurrentPad()

TYPO3\CMS\Backend\Clipboard\Clipboard::setCurrentPad (   $padIdent)

Setting the current pad on clipboard

Parameters
string$padIdent‪Key in the array $this->clipData

Definition at line 193 of file Clipboard.php.

References TYPO3\CMS\Backend\Clipboard\Clipboard\$current, TYPO3\CMS\Backend\Clipboard\Clipboard\isElements(), and TYPO3\CMS\Backend\Clipboard\Clipboard\lockToNormal().

Referenced by TYPO3\CMS\Backend\Clipboard\Clipboard\setCmd().

Member Data Documentation

◆ $changed

int TYPO3\CMS\Backend\Clipboard\Clipboard::$changed = 0

Definition at line 72 of file Clipboard.php.

◆ $clipData

array TYPO3\CMS\Backend\Clipboard\Clipboard::$clipData = array( )

Clipboard data kept here

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|[shortmd5 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)

Definition at line 68 of file Clipboard.php.

Referenced by TYPO3\CMS\Backend\Clipboard\Clipboard\initializeClipboard().

◆ $current

◆ $fileMode

bool TYPO3\CMS\Backend\Clipboard\Clipboard::$fileMode = false

If set, clipboard is displaying files.

Definition at line 86 of file Clipboard.php.

◆ $iconFactory

IconFactory TYPO3\CMS\Backend\Clipboard\Clipboard::$iconFactory
protected

Definition at line 90 of file Clipboard.php.

◆ $lockToNormal

int TYPO3\CMS\Backend\Clipboard\Clipboard::$lockToNormal = 0

Definition at line 80 of file Clipboard.php.

◆ $numberTabs

int TYPO3\CMS\Backend\Clipboard\Clipboard::$numberTabs = 3

◆ $view

StandaloneView TYPO3\CMS\Backend\Clipboard\Clipboard::$view
protected