Creating or writing Patterns

Methods

There are a few planned methods of creating patterns. Currently patterns need to be written manually until the exporter/builder are complete.

  1. Patterns Exporter/Recorder
  2. Patterns Builder
  3. Write Patterns Manually

Patterns Exporter/Recorder

Developers are working on adding the ability to export any form/page to a pattern. A user will be able to go to any form on the site and click a button to add that form to a new or existing pattern. There will also be the option to start recording and then walk through some steps on the site and have everything recorded and added to a pattern.

Patterns Builder

The Patterns Builder will guide the user through choosing from a list of Drupal entities on an existing site such as Menus, Content types (and fields,) Views, Blocks, Roles, Permissions, etc., and pick which of them they want to add to new or existing patterns.

Writing Patterns Manually

Until the exporter, recorder or builder are done Patterns should be written manually. That might sound scary, but it's not very hard. Writing and reading YAML is very easy because it's a simple text based format. Have a look at the YAML example provided with the module.

This initial documentation is geared towards the XML format but all of this applies the same to writing in YAML which will likely be much easier or fun for you to write. A little review of the YAML syntax will let you easily write any of the examples in YAML until we convert all of them to YAML for you.

File structure:

Pattern syntax: (Please note these are initial versions and some still need to be finished.)

Core:
Block
Menu
Taxonomy
Profile
System
User
Node
Variables

Contrib:
Content (CCK)
Views
Imagecache
Pathauto
Token/Identifiers

Feel free to get involved or ask questions at the Patterns group or the Patterns issue queue.

Pattern Syntax: Block

Valid properties

Pattern Syntax: Content (CCK)

Valid properties for "content" action

Pattern Syntax: Form tag

Pattern files can also use a "form" tag to directly fill in values for most Drupal forms. This is an easy way to submit forms when there isn

Pattern Syntax: ImageCache

Valid properties for "imagecache_preset" action

Pattern Syntax: Menu

Valid elements for "menu" action

Pattern Syntax: Node

Pattern Syntax: Pathauto

Overview

Pattern Syntax: Profile

Overview

Pattern Syntax: System

"theme" action

Pattern Syntax: Taxonomy

Valid tags for "vocabulary":

Pattern Syntax: Tokens & Identifiers

Documentation for the Tokens and Identifiers syntax in Patterns is coming soon...

Pattern Syntax: User

Valid tags for <user>:

Pattern Syntax: Variables

Many modules store their settings to Drupal's variables table and in all such cases "variables" action should be used instead of "form".

Pattern Syntax: Views

Documentation for the Patterns Views syntax is coming soon... for the time being refer to this example view action below.

Guide maintainers

ChrisBryant's picture