Wiki

Clone wiki

Module_Onestop_Layouts / TemplatedItems

#Using templated content items

##Making a content type template-aware

In order to be able to use dynamic templates, you need to add the TemplatedItemPart content part to a content type.

Go to Content Definition in the admin, and create a new type, or edit an existing one. Then, add the TemplatedItemPart content part to the type, then configure it to allow for template choices (otherwise, a default template with just an image will be used for all items of that type).

Configuring the templated item part

Save the content type.

##Creating and editing templated content items

Once a type has the TemplatedItemPart part attached and configured, the editor for items of this type will show a drop-down that enables the user to choose the template to use with the item. Choosing a template should be the first thing you do after creating a templated content item (and filling any other required form fields). Once a template has been chosen, save the item so that the editor can show the UI specific to that template.

Once the template choice has been made and saved, new form fields for the elements in the template that require additional information will appear. For example, an image element will let the user pick an image.

Editing a templated content item

A live preview thumbnail of the templated item is shown on the right of the editor. This preview will be updated in real-time as much as possible. The preview overlays numbers on elements so they are easier to find (the above screenshot has a "1" over the image element). The same numbers are reproduced on the left of the corresponding editor.

Templated content items show a preview in content item lists in the admin, making it easier to manage non-textual templated contents (slide shows, etc.):

Templated item preview in the admin list of items

Updated