EL Expression for a document's Parent

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!

0 votes

2 answers

2510 views

ANSWER



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!

0 votes



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.

0 votes



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/24/2015