You are here

function patterns_api_add_modules_section in Patterns 7

Same name and namespace in other branches
  1. 7.2 includes/api/ \patterns_api_add_modules_section()

Adds / Replaces the 'modules' section in a pattern.

Removes duplicates from the list of modules.


array $modules: Array containing the name of the modules

array $pattern (optional): The associative array representing a pattern

Bool $ow (optional): If TRUE, a pre-existing modules section will be overwritten. Defaults FALSE.

Return value

Bool|Array Return the array containing the the modules section, or FALSE if an error occurred

1 call to patterns_api_add_modules_section()
_patterns_export_merge_exported_patterns in patterns_export/
Merges modules info and sections in one pattern


includes/api/, line 79
API for writing pattern files.


function patterns_api_add_modules_section($modules = NULL, &$pattern = array(), $ow = FALSE) {
  if (empty($modules)) {
    return FALSE;
  if (isset($pattern['modules']) && !$ow) {
    return FALSE;
  $modules = is_array($modules) ? $modules : array(
  $pattern['modules'] = array_unique($modules);
  return $pattern;