Anatomy of a pattern file
A Pattern file contains an info section, and a sequence of actions uniquely identified by their tag name. Actions are grouped in coherent sections, which can be identified by any name.
Two other optional section names are modules and include. The former explicitly defines a list of modules to enable during the execution of the pattern, while the latter loads the actions of another pattern into the current one.
Therefore, a Pattern file has the following reserved words:
- create, modify, delete
- include (not yet fully implemented!)
Let us have a look at an example of Pattern file for dealing with Taxonomy operations:
# This is a comment
# Example Pattern
info: # mandatory name
title: New Vocabulary
description: Adds a new vocabulary to the website
author_website: <a href="http://qlectives.eu">http://qlectives.eu</a>
- taxonomy # we make sure that taxonomy is enabled
actions: # any name is good for this category
name: Another Vocabulary
description: Another interesting vocabulary
description: It was not that interesting after all
# vid: 2
# vid: 2
In the example file, the term tag: basically tells Patterns which component to call to perform the action.
Included within the tag the data required for the vocabulary action is supplied. In this example these are:
Any number of categories, in this example just actions, can be defined (excluding the reserved words) and they are executed sequentially.