Checking if there is a structured data node
Once i've successfully gotten into my block using the locator tool, is there a way to check to see if the block has a structured data node?
Discussions are closed to public comments.
If you need help with Cascade CMS please
start a new discussion.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
sbarre5 closed this discussion on 04 Mar, 2015 09:56 PM.
sbarre5 re-opened this discussion on 04 Mar, 2015 09:56 PM
1 Posted by sbarre5 on 04 Mar, 2015 09:57 PM
I posted this in the wrong category and I can't move it - this should be in velocity formats
2 Posted by Ryan Griffith on 05 Mar, 2015 06:46 PM
Hi,
Assuming the block is a Structured Data Block, you can use the
getStructuredDataNode("path/to/field")
method to obtain the field. If the field does not exist, the method should return null, which can be tested using$_PropertyTool.isNull()
.Once you get the field, you can then test it's value to see if it is empty or not.
Please let me know if you have any questions.
Thanks!
3 Posted by sbarre5 on 05 Mar, 2015 06:52 PM
Thanks Ryan. That works great!
Saundra Barrett
Senior Web Developer
Emory University, Web Design Group
Office: 404-727-3437
Cell: 404-670-1238
From: Ryan Griffith
Date: Thursday, March 5, 2015 at 1:47 PM
To: Saundra Barrett
Subject: Re: Checking if there is a structured data node [Velocity Formats #11584]
4 Posted by Ryan Griffith on 05 Mar, 2015 06:53 PM
Not a problem at all, Saundra, thank you for following up. I am glad to hear my suggestion did the trick.
I'm going to go ahead and close this discussion, please feel free to comment or reply to re-open if you have any additional questions.
Have a great day!
Ryan Griffith closed this discussion on 05 Mar, 2015 06:53 PM.