Pattern Syntax: Taxonomy

Last updated on
30 April 2025
Valid tags for "vocabulary":
  • name (not unique, required)
  • description
  • help
  • nodes
  • tags
  • multiple
  • required
  • weight

Following two tags cannot be changed through Drupal's UI:

  • hierarchy (default value 0???) Set the hierarchy to "multiple parents" by default. This simplifies the vocabulary form and standardizes the term form.
  • relations (default value 1) Enable "related terms" by default

If numeric value is given in <vocabulary> tag, it will be interpreted as vocabulary ID and not as vocabulary name. As a consequence, numeric-only vocabulary names (e.g 4, 53, 5674) are not supported by patterns module.

Vocabulary names are not required to be unique and it's possible to have two or more vocabs with the same name.

However, it is recommended to always keep the names of vocabularies unique. In case patterns come across of a duplicate vocab name and cannot determine which vocab needs to be edited, first one will be selected by default without reporting any error.

Patterns are not designed to support this type of situation at the moment and therefore it is recommended to always keep the names of the terms within vocabulary unique.

Valid tags for "term":
  • name (not unique, required)
  • description
  • parent
  • relations
  • synonyms
  • weight
  • vid
  • tid

<term> may not produce accurate results if there are multiple terms with the same name within one vocabulary.

Both <parent> and <relations> require term names. TIDs are not supported at the moment.

If defined, <parent> and <relations> will overwrite previous values when existing term is being updated.

You can define empty <parent> or <relations> tag if you want to remove all existing values. In case those tags are omitted, previous values will be preserved.

You must specify TID for "delete term" action.

Term names are not required to be unique. It's possible to have two or more terms within one vocab with the same name. Patterns are not designed to support this type of situation at the moment and therefore it is recommended to always keep the names of the terms within vocabulary unique.

YAML Examples

actions:

  - create:
        tag: vocabulary
        name: My Vocabulary
        machine_name: myvocabulary
        description: This will be a new vocabulary.
        hierarchy: 0

    - create:
        tag: term
        name: newterm
        descr: This will be a new taxonomy term.
        vocabulary: myvocabulary # machine_name

Help improve this page

Page status: Not set

You can: