class AssetController extends ActionController (View source)

Controller for asset handling

Traits

A trait to add create a content context

A trait to add backend translation based on the backend users settings

A trait to add backend translation based on the backend users settings

Constants

protected TAG_GIVEN

protected TAG_ALL

protected TAG_NONE

protected COLLECTION_GIVEN

protected COLLECTION_ALL

Properties

protected ContentContextFactory $_contextFactory from  CreateContentContextTrait
protected SiteRepository $_siteRepository from  CreateContentContextTrait
protected Service $_localizationService from  BackendUserTranslationTrait
protected UserService $_userService from  BackendUserTranslationTrait
protected Translator $_translator from  AddTranslatedFlashMessageTrait
protected array $viewFormatToObjectNameMap
protected SiteRepository $siteRepository
protected DomainRepository $domainRepository
protected AssetRepository $assetRepository
protected TagRepository $tagRepository
protected AssetCollectionRepository $assetCollectionRepository
protected PackageManager $packageManager
protected BrowserState $browserState
protected AssetService $assetService
protected AssetSourceService $assetSourceService
protected AssetVariantGenerator $assetVariantGenerator
protected AssetSourceInterface[] $assetSources
protected array $imageProfilesConfiguration

Methods

createContentContext(string $workspaceName, array $dimensions = [])

Create a ContentContext based on the given workspace name

createContextMatchingNodeData(NodeData $nodeData)

Generates a Context that exactly fits the given NodeData Workspace, Dimensions & Site.

void
initializeObject()

No description

void
addTranslatedFlashMessage(string $messageBodyTranslationId, string $severity = Message::SEVERITY_OK, array $messageArguments = [], int|null $messageCode = null)

No description

void
initializeAction()

No description

void
initializeView(ViewInterface $view)

Set common variables on the view

void
indexAction(string $view = null, string $sortBy = null, string $sortDirection = null, string $filter = null, int $tagMode = self::TAG_GIVEN, Tag $tag = null, string $searchTerm = null, int $collectionMode = self::COLLECTION_GIVEN, AssetCollection $assetCollection = null, string $assetSourceIdentifier = null)

List existing assets

void
newAction()

New asset form

void
replaceAssetResourceAction(Asset $asset)

No description

void
showAction(string $assetSourceIdentifier, string $assetProxyIdentifier)

Show an asset

void
editAction(string $assetSourceIdentifier, string $assetProxyIdentifier)

Edit an asset

void
variantsAction(string $assetSourceIdentifier, string $assetProxyIdentifier, string $overviewAction)

Display variants of an asset

void
createVariantsAction(string $assetSourceIdentifier, string $assetProxyIdentifier, string $overviewAction)

Create missing variants for the given image

void
initializeUpdateAction()

No description

void
updateAction(Asset $asset)

Update an asset

void
initializeCreateAction()

Initialization for createAction

void
createAction(Asset $asset)

Create a new asset

void
initializeUploadAction()

Initialization for uploadAction

string
uploadAction(Asset $asset)

Upload a new asset. No redirection and no response body, for use by plupload (or similar).

void
tagAssetAction(Asset $asset, Tag $tag)

Tags an asset with a tag.

void
addAssetToCollectionAction(Asset $asset, AssetCollection $assetCollection)

Adds an asset to an asset collection

void
deleteAction(Asset $asset)

Delete an asset

void
updateAssetResourceAction(AssetInterface $asset, PersistentResource $resource, array $options = [])

Update the resource on an asset.

void
relatedNodesAction(AssetInterface $asset)

Get Related Nodes for an asset (proxy action)

void
createTagAction(string $label)

No description

void
editTagAction(Tag $tag)

No description

void
updateTagAction(Tag $tag)

No description

void
deleteTagAction(Tag $tag)

No description

void
createAssetCollectionAction(string $title)

No description

void
editAssetCollectionAction(AssetCollection $assetCollection)

No description

void
updateAssetCollectionAction(AssetCollection $assetCollection)

No description

void
deleteAssetCollectionAction(AssetCollection $assetCollection)

No description

string
errorAction()

This custom errorAction adds FlashMessages for validation results to give more information in the

Message|bool
getErrorFlashMessage()

Individual error FlashMessage that hides which action fails in production.

Details

protected ContentContext createContentContext(string $workspaceName, array $dimensions = [])

Create a ContentContext based on the given workspace name

Parameters

string $workspaceName

Name of the workspace to set for the context

array $dimensions

Optional list of dimensions and their values which should be set

Return Value

ContentContext

protected ContentContext createContextMatchingNodeData(NodeData $nodeData)

Generates a Context that exactly fits the given NodeData Workspace, Dimensions & Site.

Parameters

NodeData $nodeData

Return Value

ContentContext

void initializeObject()

No description

Return Value

void

void addTranslatedFlashMessage(string $messageBodyTranslationId, string $severity = Message::SEVERITY_OK, array $messageArguments = [], int|null $messageCode = null)

No description

Parameters

string $messageBodyTranslationId
string $severity
array $messageArguments
int|null $messageCode

Return Value

void

protected void initializeAction()

No description

Return Value

void

Exceptions

NoSuchArgumentException

protected void initializeView(ViewInterface $view)

Set common variables on the view

Parameters

ViewInterface $view

Return Value

void

void indexAction(string $view = null, string $sortBy = null, string $sortDirection = null, string $filter = null, int $tagMode = self::TAG_GIVEN, Tag $tag = null, string $searchTerm = null, int $collectionMode = self::COLLECTION_GIVEN, AssetCollection $assetCollection = null, string $assetSourceIdentifier = null)

List existing assets

Parameters

string $view
string $sortBy
string $sortDirection
string $filter
int $tagMode
Tag $tag
string $searchTerm
int $collectionMode
AssetCollection $assetCollection
string $assetSourceIdentifier

Return Value

void

Exceptions

FilesException

void newAction()

New asset form

Return Value

void

void replaceAssetResourceAction(Asset $asset)

No description

Parameters

Asset $asset

Return Value

void

void showAction(string $assetSourceIdentifier, string $assetProxyIdentifier)

Show an asset

Parameters

string $assetSourceIdentifier
string $assetProxyIdentifier

Return Value

void

Exceptions

StopActionException
UnsupportedRequestTypeException

void editAction(string $assetSourceIdentifier, string $assetProxyIdentifier)

Edit an asset

Parameters

string $assetSourceIdentifier
string $assetProxyIdentifier

Return Value

void

Exceptions

StopActionException
UnsupportedRequestTypeException

void variantsAction(string $assetSourceIdentifier, string $assetProxyIdentifier, string $overviewAction)

Display variants of an asset

Parameters

string $assetSourceIdentifier
string $assetProxyIdentifier
string $overviewAction

Return Value

void

Exceptions

StopActionException
UnsupportedRequestTypeException

void createVariantsAction(string $assetSourceIdentifier, string $assetProxyIdentifier, string $overviewAction)

Create missing variants for the given image

Parameters

string $assetSourceIdentifier
string $assetProxyIdentifier
string $overviewAction

Return Value

void

Exceptions

StopActionException
UnsupportedRequestTypeException

protected void initializeUpdateAction()

No description

Return Value

void

Exceptions

NoSuchArgumentException

void updateAction(Asset $asset)

Update an asset

Parameters

Asset $asset

Return Value

void

Exceptions

StopActionException
IllegalObjectTypeException

protected void initializeCreateAction()

Initialization for createAction

Return Value

void

Exceptions

NoSuchArgumentException

void createAction(Asset $asset)

Create a new asset

Parameters

Asset $asset

Return Value

void

Exceptions

StopActionException
IllegalObjectTypeException

protected void initializeUploadAction()

Initialization for uploadAction

Return Value

void

Exceptions

NoSuchArgumentException

string uploadAction(Asset $asset)

Upload a new asset. No redirection and no response body, for use by plupload (or similar).

Parameters

Asset $asset

Return Value

string

Exceptions

IllegalObjectTypeException

void tagAssetAction(Asset $asset, Tag $tag)

Tags an asset with a tag.

No redirection and no response body, no flash message, for use by plupload (or similar).

Parameters

Asset $asset
Tag $tag

Return Value

void

Exceptions

IllegalObjectTypeException

void addAssetToCollectionAction(Asset $asset, AssetCollection $assetCollection)

Adds an asset to an asset collection

Parameters

Asset $asset
AssetCollection $assetCollection

Return Value

void

Exceptions

IllegalObjectTypeException

void deleteAction(Asset $asset)

Delete an asset

Parameters

Asset $asset

Return Value

void

Exceptions

IllegalObjectTypeException
StopActionException
AssetServiceException

void updateAssetResourceAction(AssetInterface $asset, PersistentResource $resource, array $options = [])

Update the resource on an asset.

Parameters

AssetInterface $asset
PersistentResource $resource
array $options

Return Value

void

Exceptions

StopActionException
ForwardException

void relatedNodesAction(AssetInterface $asset)

Get Related Nodes for an asset (proxy action)

Parameters

AssetInterface $asset

Return Value

void

Exceptions

ForwardException

void createTagAction(string $label)

No description

Parameters

string $label

Return Value

void

Exceptions

ForwardException

void editTagAction(Tag $tag)

No description

Parameters

Tag $tag

Return Value

void

Exceptions

ForwardException

void updateTagAction(Tag $tag)

No description

Parameters

Tag $tag

Return Value

void

Exceptions

ForwardException

void deleteTagAction(Tag $tag)

No description

Parameters

Tag $tag

Return Value

void

Exceptions

ForwardException

void createAssetCollectionAction(string $title)

No description

Parameters

string $title

Return Value

void

Exceptions

ForwardException

void editAssetCollectionAction(AssetCollection $assetCollection)

No description

Parameters

AssetCollection $assetCollection

Return Value

void

Exceptions

ForwardException

void updateAssetCollectionAction(AssetCollection $assetCollection)

No description

Parameters

AssetCollection $assetCollection

Return Value

void

Exceptions

ForwardException

void deleteAssetCollectionAction(AssetCollection $assetCollection)

No description

Parameters

AssetCollection $assetCollection

Return Value

void

Exceptions

ForwardException

protected string errorAction()

This custom errorAction adds FlashMessages for validation results to give more information in the

Return Value

string

protected Message|bool getErrorFlashMessage()

Individual error FlashMessage that hides which action fails in production.

Return Value

Message|bool

The flash message or false if no flash message should be set