Expression to validate an individual item (asset or folder). For example, the plugin exclusively works with video assets.
Selected assets are filtered by the filterExpression when the action is executed. This results in a filtered selection in the elvisContext, only items that match the filterExpression are in the final selection.
The filterExpression can also be used in combination with elvisContext.hasFilteredSelection() as enabledExpression. This enhances the enabled validation with validation on individual items.
<action>
<filterExpression>...</filterExpression>
</action>
Methods
- item.isFolder(). Returns true when the item is a folder.
- item.isContainer(). Returns true when the item is a container asset (collection).
- item.isAsset(). Returns true when the item is an asset.
- item.hasAssetDomain(assetDomain:String). Returns true when the item is an asset and it matches the given assetDomain.
Examples
A plugin that requires a single folder selection
<enabledExpression>elvisContext.isSingleItem()</enabledExpression>
<filterExpression>item.isFolder()</filterExpression>
A plugin that works with a selection of images
In this sample, the selection must contain at least one image, the final selection in the elvisContext is filtered by the filterExpression and will only contain images.
<enabledExpression>elvisContext.hasSelection()</enabledExpression>
<filterExpression>item.hasAssetDomain("image")</filterExpression>
A plugin that works with videos and images
<enabledExpression>elvisContext.hasSelection()</enabledExpression>
<filterExpression>item.hasAssetDomain("image") || item.hasAssetDomain("video")</filterExpression>
A plugin that requires a selection of images
In this sample, the selection should only contain images or containers (if flattenContainersInSelection is true), the plugin will be disabled if the selection also contains other asset types.
<enabledExpression>elvisContext.hasFilteredSelection()</enabledExpression>
<filterExpression>item.hasAssetDomain("image")</filterExpression>
A plugin that requires a single selected PDF
<enabledExpression>elvisContext.hasFilteredSelection() && elvisContext.isSingleItem()</enabledExpression>
<filterExpression>item.hasAssetDomain("pdf")</filterExpression>
Comments
Do you have corrections or additional information about this article? Leave a comment!
Do you have a question about what is described in this article? Please contact support here.
0 comments
Please sign in to leave a comment.