Locator Tool and Serializer Tool
Hi,
First let me say that we love the locator tool! It's helping us cut down our rendering time. :)
That said, I was wondering if it's possible to use the Serializer Tool on WYSIWYG content pulled with the Locator Tool? I tried this:
#set ( $physical_address = $page.getStructuredDataNode("department-information/physical-address").textValue)
## Using the escape tool sort of works...
$_EscapeTool.xml($physical_address)
## The serializer tool does not work
$_SerializerTool.serialize(physical_address, true)
The above outputs:
<p>Words words words<br/>Even more words</p>
$_SerializerTool.serialize(physical_address, true)
The Escape tool shows the mark up from the WYSIWYG (which I expected) in the output, and the way that I'm trying to use the serializer tool doesn't do anything at all. Any help is appreciated. Thanks!
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
1 Posted by Ryan Griffith on 28 Mar, 2014 01:18 PM
Hi Ashley,
It looks like you are missing the dollar sign before the physical_address variable. When you have a moment, try the following and let me know how it works out:
Please let me know if you have any questions.
Thanks!
2 Posted by Ashley Williams on 31 Mar, 2014 12:37 PM
After adding the $ to physical address, I still have the same problem (though I should have noticed that before asking, thanks for catching that). Now the output is:
3 Posted by Ryan Griffith on 31 Mar, 2014 03:14 PM
Thank you for following up, Ashley.
Looking over your code snippet again, I noticed you are setting the
$physical_address
variable to the node'stextValue
property. I suspect the issue is occurring because the Serializer Tool expects a JDOM Element to serialize, but you are passing in a String.When you have a moment, try the following and let me know how it works out:
Please let me know if you have any questions.
Thanks!
4 Posted by Ashley Williams on 31 Mar, 2014 03:37 PM
Removing ".textValue" doesn't seem to work either. Here's my code in its entirety (though I did take out the EscapeTool part since that no longer works after I removed .textValue):
5 Posted by Ryan Griffith on 31 Mar, 2014 03:59 PM
Hi Ashley,
Thank you for providing the entire Format.
It looks like you are displaying the content outside of the
#foreach
loop. Perhaps try moving that inside of the loop to see if that changes the output.Also, can you confirm the
#if
statement that outputs the content is returning true?Correct, the Escape Tool expects a String, so passing in the JDOM Element will cause that to break. If you do need to escape the content, you would want to pass the serialized content into the Escape Tool. Something like the following:
Please let me know if you have any questions.
Thanks!
6 Posted by Ashley Williams on 31 Mar, 2014 04:11 PM
This is what made it work. I have the below set up in the #foreach loop:
Then I used ${physical_address} to display it in the #if statement. Thank you for your help!
7 Posted by Ryan Griffith on 31 Mar, 2014 04:15 PM
Ah, my apologies, Ashley. I didn't take notice of the
getStructuredDataNode
part, so you're right in thattextValue
should give you the content to serialize.I am glad to hear you were about to get things working. I'll go ahead and close this discussion, but 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 31 Mar, 2014 04:15 PM.