The Patterns module in Drupal hierarchically looks for pattern files in the following locations:

  1. The Drupal public files folder (usually /sites/default/files/patterns/);
  2. A user defined folder (default: /sites/all/patterns/);
  3. The Patterns module patterns directory (usually /sites/all/modules/patterns/patterns/);
  4. Any installation profile directory (e.g. /profiles/standard/patterns).

These patterns are filed such that they are uniquely identified by their file name. In cases where two or more patterns have the same file name in different locations, only the first one patter is loaded.

When a file is modified through the web interface of Patterns, a new pattern file is saved in the directory at the topmost of the hierarchy defined in the Drupal public files folder. The changes are stored in the database. If the file is stored originally somewhere else, it remains unchanged.