01-22-2015 07:47 PM
I'm trying to write an EL expression so I can place it in the Advanced Configurations section where, given a File document type, if the parent of the File is a Folder document type, then I want the "State" and "Workflow" widgets to be hidden. Here's what I've found so far:
documentManager.getDocument(document.getData().getParentRef()).getParent("Folder") == 'hidden'
Any ideas for getting this EL expression right? I'm planning on putting this in the Advanced Configuration section in the widget.
Thanks!
01-23-2015 05:47 AM
Hi,
The variable "document" exposed by the layout service has been deprecated, you should use "layoutValue" instead.
This variable will map the object that the layout binds to.
In a basic form, the layout will be bound to a document model, so you should be able to use the following syntax:
documentManager.getDocument(layoutValue.getParentRef()).getParent("Folder") == null ? 'hidden': mode
If your widget is actually inside a listing, the layout is bound to a PageSelection element, so you can get the wrapped document by calling #getData() on it. In this case, the following expression should work:
documentManager.getDocument(layoutValue.getData().getParentRef()).getParent("Folder") == null ? 'hidden': mode
I haven't tested these, please tell if there are issues with them.
Also see the documentation about layout expressions and variables.
01-23-2015 07:28 PM
I tried both of these and neither of them did anything in the Advanced mode Configuration. They need a #{ } around them right? And I should just be able to copy and paste these expressions?
01-23-2015 08:15 PM
Nevermind, I just used the activation for the whole tab where you can conditionally show it with a parent's pathway, which works out better for me. Thanks!