Logo Help Center

Action plugin setting - filterExpression

Elvis 5 action plug-ins setting - filterExpression

(8) Optional setting

Expression to validate an individual item (asset or folder). For example, the plug-in 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 plug-in that requires a single folder selection

<enabledExpression>elvisContext.isSingleItem()</enabledExpression>
<filterExpression>item.isFolder()</filterExpression>

A plug-in 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 plug-in that works with videos and images

<enabledExpression>elvisContext.hasSelection()</enabledExpression>
<filterExpression>item.hasAssetDomain("image") || item.hasAssetDomain("video")</filterExpression>

A plug-in that requires a selection of images

In this sample, the selection should only contain images or containers (if flattenContainersInSelection is true), the plug-in will be disabled if the selection also contains other asset types.

<enabledExpression>elvisContext.hasFilteredSelection()</enabledExpression>
<filterExpression>item.hasAssetDomain("image")</filterExpression>

A plug-in that requires a single selected PDF

<enabledExpression>elvisContext.hasFilteredSelection() && elvisContext.isSingleItem()</enabledExpression>
<filterExpression>item.hasAssetDomain("pdf")</filterExpression>
Was this article helpful?
0 out of 0 found this helpful / Created: / Updated:
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.