This class provides utility methods for the Elvis Pro client plug-ins. It simplifies access to the elvisContext provided by the Pro client.
Functions
resolveElvisContext( )
Use this method to resolve the elvisContext either from the window or parent if running in iframe (for an action plug-in opened in external browser).
queryForSelection( pluginHits )
Creates a query like (id:... OR id:... OR id:...) to search all hits in the elvisContext selection.
resolveQueryString( )
This method returns the query string that was used as search in the Pro client. When available, it returns the search used in the current search tab, otherwise it returns the search entered in the top-left search field.
How to use
You can use the Elvisplug-in class to get context in action plug-ins. The following example resolves the elvisContext and uses that to resolve the current assetSelection.
var elvisContext = ElvisPlugin.resolveElvisContext();
var selection = elvisContext.activeTab.assetSelection;
For certain types of action plug-ins you may want use the current query as entered by the user in the Pro client. For example to search through an external website. The resolveQueryString() function will automatically resolve the most appropriate search entered by the user.
var query = ElvisPlugin.resolveQueryString();
if (query != null) {
window.location = "http://www.flickr.com/search/?q=" + encodeURIComponent(query);
}
else {
//alert("Hey, your search in Elvis is empty!");
window.location = "http://www.flickr.com";
}
Comment
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.
0 comments
Please sign in to leave a comment.