Improvement of the export functions and components extension

The new version of Patterns provides a set of enhancements to export automatically the configuration of a site. All the main components possess now automatic export capabilities, and depending on the type of component new options to export it are offered.

Two different use cases are distinguised:

  1. Export the configuration as a pattern consisting of a set of CREATE actions which allows users the creation of patterns for “fresh installation” of certain feature,
  2. Export the configuration as a pattern consisting of a set of MODIFY actions which allows users the creation of patterns to override the current settings (e.g., to update the features developed in a testing site to a production site). The patterns generated ensure idempotency in the operations.

An analysis was performed in order to classify the required export configuration processes according to the semantic of the tag itself. For most of the components exporting the configuration as a set of CREATE or MODIFY actions makes sense semantically for both cases, but there are some exceptions, e.g., for the colour component only the MODIFY case makes sense, since it is always present in the system.

The table belows provides information about the supported export configuration processes for each tag.

Exporting configuration

Important: This page is a tour of the code for the submodule patterns_export and the components. If you are looking for information on how to write a an export function for a component please read this section before.

Exporting patterns: Flow of Execution

In this section we will analyze the flow of execution provided by the submodule patterns_export, that allows us to extract Patterns files automatically. For this example we will be using the color component.

  • A new entry in the menu is set by hook_menu_alter(). The function called when accessing to the url is patterns_export(), which will check if there are any parsers available and call the function patterns_export_page1() after loading all the components.
  • The function patterns_export_page1() will take care of:
    • Invoke all the modules implementing patterns, and filter those which provide any export function.
    • Prepare the form with the granularity options to export for each of these components (i.e.: the taxonomy component allows to export terms and/or vocabularies).
Subscribe with RSS Subscribe to RSS - export configuration