function patterns_execute_config in Patterns 7.2
Same name and namespace in other branches
- 6.2 patterns.module \patterns_execute_config()
- 6 patterns.module \patterns_execute_config()
- 7 includes/unused.inc \patterns_execute_config()
Executes default configuration for module during the module installation.
This function should be called by other modules from within their hook_enable() implementation. Module should also provide modulename.config file containing PHP array with the actions that need to be executed.
Parameters
string $module: Name of the module calling the function.
Return value
@TODO Doc.
File
- includes/
unused.inc, line 612 - Functions that are unused at the moment.
Code
function patterns_execute_config($module) {
// since this function is called from hook_enable(), we need to ensure that
// it's executed only at module installation (first time module is enabled)
if (drupal_get_installed_schema_version($module) == SCHEMA_INSTALLED) {
return;
}
$path = drupal_get_path('module', $module) . '/' . $module . '.config';
if (file_exists($path)) {
require_once $path;
if (empty($actions)) {
return;
}
$pattern = new stdClass();
$pattern->title = t('Default configuration for @module module', array(
'@module' => $module,
));
$pattern->status = FALSE;
$pattern->pattern['actions'] = $actions;
return patterns_start_engine($pattern);
}
}