MODX Quick Tip: TV Input Options from JSON (schema.org)

#MODX Quick Tip: TV Input Options from JSON (schema.org)

Feb 16, 2016

What does it do?

This MODX Snippet consumes JSON (string or file) and, based on the specified properties, will build a string formatted for use in a MODX TV input options field. The result looks something like this:

Schema.org CMS Input Options

Example Usage

To produce the result seen in the screenshot above, do the following in your MODX site:

  1. Create a Chunk with this Snippet call:
[[getTVInputsFromJson? &jsonFile=`http://schema.org/docs/tree.jsonld`]]
  1. Create a Single-Select TV with @CHUNK binding for "Input Options":
@CHUNK my_schema_tv_chunk
  1. Resources with the TV enabled will get a list of schema.org itemtype property values, like the screenshot above.

The Gist

The Snippet code is in a gist. More info can be found in the code comments. Happy MODX-ing!