FormFileProvider extends FileProvider
Purges previously added form files from items for context menus.
Table of Contents
Properties
- $backendUser : BackendUserAuthentication
- $clipboard : Clipboard
- $context : string
- Context - from where the click menu was triggered (e.g. 'tree')
- $disabledItems : array<string|int, mixed>
- Click menu items disabled by TSConfig
- $identifier : string
- $itemsConfiguration : array<string|int, mixed>
- Array of items the class is providing
- $languageService : LanguageService
- Language Service property. Used to access localized labels
- $record : File|Folder|null
- $table : string
- Current table name
Methods
- __construct() : mixed
- addItems() : array<string|int, mixed>
- Adds new items to the given array or modifies existing items
- canHandle() : bool
- Whether this provider can handle given request (usually a check based on table, uid and context)
- getPriority() : int
- Lowest priority, thus gets executed last.
- setContext() : void
- Initialize the current context.
- canBeCopied() : bool
- canBeCut() : bool
- canBeDeleted() : bool
- canBeDownloaded() : bool
- canBeEdited() : bool
- canBePastedInto() : bool
- canBeRenamed() : bool
- canCreateNew() : bool
- canCreateNewFilemount() : bool
- New filemounts can only be created for readable folders by admins
- canEditMetadata() : bool
- canRender() : bool
- Checks whether certain item can be rendered (e.g. check for disabled items or permissions)
- canShowInfo() : bool
- getAdditionalAttributes() : array<string|int, mixed>
- Returns an array of additional attributes for given item. Additional attributes are used to pass item specific data to the JS. E.g. message for the delete confirmation dialog
- getIdentifier() : string
- Returns a clicked record identifier
- initClipboard() : mixed
- Initialize clipboard object - necessary for all copy/cut/paste operations
- initDisabledItems() : mixed
- Fills $this->disabledItems with the values from TSConfig.
- initialize() : mixed
- Initialize file object
- isFile() : bool
- isFolder() : bool
- isFoldersAreInTheSameRoot() : bool
- Checks if folder and record are in the same filemount Cannot copy folders between filemounts
- isOnlineMedia() : bool
- isRecordInClipboard() : bool
- Checks if a file record is in the "normal" pad of the clipboard
- isStorageRoot() : bool
- prepareItems() : array<string|int, mixed>
- Converts item configuration (from $this->itemsConfiguration) into an array ready for returning by controller
- purgeItems() : array<string|int, mixed>
- Purges items that are not allowed for according command.
Properties
$backendUser
protected
BackendUserAuthentication
$backendUser
$clipboard
protected
Clipboard
$clipboard
$context
Context - from where the click menu was triggered (e.g. 'tree')
protected
string
$context
= ''
$disabledItems
Click menu items disabled by TSConfig
protected
array<string|int, mixed>
$disabledItems
= []
$identifier
protected
string
$identifier
= ''
clicked record identifier (usually uid or file combined identifier)
$itemsConfiguration
Array of items the class is providing
protected
array<string|int, mixed>
$itemsConfiguration
= []
$languageService
Language Service property. Used to access localized labels
protected
LanguageService
$languageService
$record
protected
File|Folder|null
$record
$table
Current table name
protected
string
$table
= ''
Methods
__construct()
public
__construct() : mixed
addItems()
Adds new items to the given array or modifies existing items
public
addItems(array<string|int, mixed> $items) : array<string|int, mixed>
Parameters
- $items : array<string|int, mixed>
Return values
array<string|int, mixed>canHandle()
Whether this provider can handle given request (usually a check based on table, uid and context)
public
canHandle() : bool
Return values
boolgetPriority()
Lowest priority, thus gets executed last.
public
getPriority() : int
Return values
intsetContext()
Initialize the current context.
public
setContext(string $table, string $identifier[, string $context = '' ]) : void
This method is called directly after fetching the provider from the container.
Parameters
- $table : string
- $identifier : string
- $context : string = ''
canBeCopied()
protected
canBeCopied() : bool
Return values
boolcanBeCut()
protected
canBeCut() : bool
Return values
boolcanBeDeleted()
protected
canBeDeleted() : bool
Return values
boolcanBeDownloaded()
protected
canBeDownloaded() : bool
Return values
boolcanBeEdited()
protected
canBeEdited() : bool
Return values
boolcanBePastedInto()
protected
canBePastedInto() : bool
Return values
boolcanBeRenamed()
protected
canBeRenamed() : bool
Return values
boolcanCreateNew()
protected
canCreateNew() : bool
Return values
boolcanCreateNewFilemount()
New filemounts can only be created for readable folders by admins
protected
canCreateNewFilemount() : bool
Return values
boolcanEditMetadata()
protected
canEditMetadata() : bool
Return values
boolcanRender()
Checks whether certain item can be rendered (e.g. check for disabled items or permissions)
protected
canRender(string $itemName, string $type) : bool
Parameters
- $itemName : string
- $type : string
Return values
boolcanShowInfo()
protected
canShowInfo() : bool
Return values
boolgetAdditionalAttributes()
Returns an array of additional attributes for given item. Additional attributes are used to pass item specific data to the JS. E.g. message for the delete confirmation dialog
protected
getAdditionalAttributes(string $itemName) : array<string|int, mixed>
Parameters
- $itemName : string
Return values
array<string|int, mixed>getIdentifier()
Returns a clicked record identifier
protected
getIdentifier() : string
Return values
stringinitClipboard()
Initialize clipboard object - necessary for all copy/cut/paste operations
protected
initClipboard() : mixed
initDisabledItems()
Fills $this->disabledItems with the values from TSConfig.
protected
initDisabledItems() : mixed
Disabled items can be set separately for each context.
initialize()
Initialize file object
protected
initialize() : mixed
isFile()
protected
isFile() : bool
Return values
boolisFolder()
protected
isFolder() : bool
Return values
boolisFoldersAreInTheSameRoot()
Checks if folder and record are in the same filemount Cannot copy folders between filemounts
protected
isFoldersAreInTheSameRoot(File|Folder|null $fileOrFolderInClipBoard) : bool
Parameters
Return values
boolisOnlineMedia()
protected
isOnlineMedia() : bool
Return values
boolisRecordInClipboard()
Checks if a file record is in the "normal" pad of the clipboard
protected
isRecordInClipboard([string $mode = '' ]) : bool
Parameters
- $mode : string = ''
-
"copy", "cut" or '' for any mode
Return values
boolisStorageRoot()
protected
isStorageRoot() : bool
Return values
boolprepareItems()
Converts item configuration (from $this->itemsConfiguration) into an array ready for returning by controller
protected
prepareItems(array<string|int, mixed> $itemsConfiguration) : array<string|int, mixed>
Parameters
- $itemsConfiguration : array<string|int, mixed>
Return values
array<string|int, mixed>purgeItems()
Purges items that are not allowed for according command.
protected
purgeItems(array<string|int, mixed> $items) : array<string|int, mixed>
According canBeEdited, canBeRenamed, ... commands will always return false in order to remove those form file items.
Using the canRender() approach avoid adding hardcoded index name lookup. Thus, it's streamlined with the rest of the provides, but actually purges items instead of adding them.
Parameters
- $items : array<string|int, mixed>