Restricting Visibility of a Plugin to Specific Entries in CM
By default, plugins are visible for a given number of entries and/or specific entries, let's call it a default plugin visibility.
For example in Content Manager:
pluginCmDelete is visible if at least one entry is selected.
pluginCmPremiere is visible only for one entry of class DigaCutMT-Project or DigaCutST-Project.
You can restrict further the visibility of your plugins by configuring the IsVisibleFor0Entries (no entry selected) and/or IsVisible (one or more entries selected) plugin keys with a logical expression by the help of different operators (e.g. +, - etc...), simple values (e.g. 1.24, 'mystring') as well as object properties via get operator (e.g. get('Table')).
If the default plugin visibility is true then :
if no item is selected, IsVisibleFor0Entries will be evaluated, and if it evaluates to true :
if IsVisibleFor0Entries is not starting by an exclamation mark (!) then the IsVisible plugin key will also be evaluated if the expression can be evaluated in the context of an empty selection otherwise the plugin will not be visible.
if IsVisibleFor0Entries starts with an exclamation mark (!), then IsVisible is ignored, plugin will be visible.
if you selected entries, IsVisible will be evaluated against each item of your selection. If IsVisible is true for all selected items, then the plugin will be visible.
Beware you can only restrict the visibility to specific entries, not enlarge, as the default plugin visibility is checked before your IsVisible.
Restricting visibility of a top level menu item would also affect all sub-menu items.
Examples
IsVisibleFor0Entries | Description |
---|---|
true | If no entry is selected, the plugin will be visible only if IsVisible also evaluates to true. |
!true | If no entry is selected, the plugin will be visible. IsVisible is ignored. |
!uppercase(get('Table')) == 'VM-SQL-DIGAS\\DEMO_WECONNECT' | If no entry is selected, the plugin will be visible if CM has the selected table VM-SQL-DIGAS\DEMO_WECONNECT. IsVisible is ignored |
IsVisible | Description |
---|---|
Title == "New group" and (Number > 1750 or Number <= 1734) | Checks that the entry title equals "New group" and its ID/Number is not between 1735 and 1750. |
get('mainMedium.SubClips.length') > 0 | Checks that the main medium has at least one subclip. |
get('Story') == 0 | Checks if the selected item is an entry |
not(contains(get('mainMedium.FileRef'), '.WAV')) and not(contains(get('mainMedium.FileRef'), '.wav')) | Checks if the main medium file does not have the wav extension. Values are case sensitive. To make it case insensitive, see next example below |
contains(uppercase(get('mainMedium.FileRef')), '.PNG') | Checks if the main medium fileref has the png extension with case insensitive |
get('mainMediumType') == 'Audio' | Checks if the main medium type is audio |
not(get('hasAudio')) | Checks if the entry has no audio |
get('hasAudio') or get('hasVideo') | Checks if the entry has audio or video. |
get('isDavidVideoProject') or get('isDigaCutProject') | Checks if the entry is a isDigaCutProject or isDavidVideoProject |
uppercase(get('Table')) == 'VM-SQL-DIGAS\\DEMO_WECONNECT' | Checks for a specified table |
hostname() == 'vm-dpedemo' | Checks for a specified hostname |
isBrowserBridgeAvail() == true | Checks for availability of Browser Bridge A re-login into DPE is required to reflect any change in availability of Browser Bridge Service. |
Basic Operators
You can use the following operators in IsVisible value.
The operator names are case sensitive!
e.g. nOT, Or, anD will not be interpreted as resp. not, or, and operators.
Operator | Description |
---|---|
(...) | Grouping |
f(...) | Function call |
x.y | Property access |
+, -, *, /, % | Arithmetic addition, subtraction, multiplication, division, remainder |
|| | String concatenation |
==, !=, >=, <=, >, < | Comparison operators |
and | Logical AND |
or | Logical OR |
not | Logical NOT |
x ? y : z | Ternary conditional (if x then y else z) |
sin, cos, tan, asin, acos, atan, sinh, cosh, tanh, asinh, acosh, atanh, sqrt, log, ln, lg, log 10, abs, ceil, floor, round, trunc, length | Arithmetic operations e.g. abs(exp(1)) returns the absolute value of exponential 1 |
! | Factorial |
^, exp | Exponentiation |
Advanced Operators
More advanced operators that deal with object properties:
Operator | Description |
---|---|
get(x) | this is to access properties of your selected objects. |
contains(x,y) | returns true if x contains y, using the indexOf js function |
uppercase(x) | returns x in uppercase, good for case insensitive comparisons |
hostname() | returns window.location.hostname |
CM Entry Properties
Only for entries. You can access entry properties as below by using the get operator.
Property | Description |
---|---|
get('title') | Returns the title of the entry |
get('id') | Returns the id of the entry |
get('hasThumbnail') | Returns true if the entry has a thumbnail |
get('Table') | Returns the entry table formatted as <dsn>\<table name> |
You can find more properties for entries there : Available Binding Values in Content Manager
Computed Property | Description |
---|---|
get('mainMediumType') | Returns the class of the main medium content. |
get('hasAudio') | Returns true if the entry has an audio medium |
get('hasAudioFile') | Returns true if the entry has a non-virtual main medium of type Audio |
get('hasVideo') | Returns true if the entry has a video medium |
get('isDavidVideoProject') | Returns true if the entry is a DavidVideo project |
get('isDigaCutProject') | Returns true if the entry is a DigaCut project |
get('rtfMedium') | Returns the entry rtf medium if exists, else null |
get('hasRtf') | Returns true if the entry has a rtf |
CM Properties when no entry is selected
Property | Description |
---|---|
get('Table') | Returns the current table formatted as <dsn>\<table name>. If multiple tables are selected, this returns null. |