Pattern Syntax: System

Last updated on
30 April 2025

"theme" action

Set default theme. All other themes will be disabled at the same time.

<theme>MyTheme</theme>

"form" action

Form action allows you to execute any Drupal form that is not directly supported by patterns module.
This action has certain limitations - it can't support forms that require complex data types as arguments - only scalar values and arrays are supported.

Valid elements of "form" action:

  • form_id - id of the form you want to execute (required)
  • args - additional arguments to be passed to form function - only scalar values and arrays are supported
  • form_state_extras - in some cases form submit function may depend on particular value being set within $form_state array but outside of $form_state['values']
  • other elements are defined by the form in question and can be determined by using patterns for helper

Many form callbacks are stored in the ".inc" files that are loaded only when required. Form action takes care of loading required include file automatically, but in the case auto-loading fails you may use one of the following:

  1.       include:
            module: name of the module this form is belonging to
            file: path to inc file relative to module's directory
        
  2. module - name of the module this form is belonging to (note that this may fail if .inc file has non-standard name or location - use it only if you don't know how to locate include file)

Example:

  - tag: form
      form_id: context_ui_form
      args:
        - add
      form_state_extras:
        clicked_button:
          "#id": edit-submit
      system: 0
      value: homepage2
      attribute: section
      namespace: context_ui
      section: homepage2
      items:
          node:
            page: 0
            story: story
          user:
            2: 2
          theme_section:
            title: Section Title
            subtitle: Section Subtitle
            class: section-css
          theme_regiontoggle:
            left: left

"modules" action

This action can be used inside "actions" section for both enabling and disabling modules.

IMPORTANT: Don't try to mix both enable and disable actions within the same "modules" action. Instead, create separate actions for "enable module" and "disable module". See examples below.

Recommended syntax (when using "modules" within actions section):

Enable module (XML)

  <modules>imagefield</modules>

Disable single module (XML):

  <modules disable="1">number</modules>

Disable multiple modules (XML):

    <modules>
      <module disable="1">number</module>
      <module disable="1">token_actions</module>      
    </modules>   

Enable single module (YAML):

 modules:
   - devel

Disable single module (YAML):

  - tag: modules
    value: devel
    disable: 1

Disable multiple modules (YAML):

  - tag: modules
    - value: admin_menu
      disable: 1
    - value: blog
      disable: 1
    - value: forum
      disable: 1

Help improve this page

Page status: Not set

You can: