Developers! We're excited to let you know that the Flexible CMS is getting a little more flexible with two brand new tokens: text & json.
The "text" token
Ever need a simple line of text that you'd like your client to edit - but you don't want to give them all the options in the WYSIWYG? Look no further than the new
text token. It works somewhat similarly to the
module token - you need to give it a unique "id" attribute. Unlike modules however, there is no "Add Text" dropdown, it is simply created automatically when you view your page as an admin. From here, you can set it as global (to see it on more than one page). How do you edit? Simple, click on the text and edit it. Your changes are saved automatically. The savvy among you probably guessed it's using contenteditable="true" - and it's supported on all major browsers and even IE7!
Here's a video to show how easy it is to make changes using the
The "json" token
We loved introducing the API a few months back, but we got to thinking. Sometimes you don't want to wait for an AJAX call to get your data. Wouldn't it be nice if that data was waiting for you in a handy JSON string? That's the concept behind the
json token. Using the same attributes and response style as the API, you can make a json token that will get rendered into a JSON string. This is very useful if you want to pull data from a known Item List or perhaps from a Product or Category.
Here's an example from the Guatemala Starter Design's Item List called "Cities".