function patterns_unpublish_pattern in Patterns 7
Same name and namespace in other branches
- 6.2 patterns.module \patterns_unpublish_pattern()
- 6 patterns.module \patterns_unpublish_pattern()
- 7.2 includes/servers.inc \patterns_unpublish_pattern()
Callback function for route /admin/patterns/unpublish/
Sets the flag public to FALSE in the database and invokes the hook_patterns_unpublish in all the modules implementing it.
Redirects the user to the patterns home.
Parameters
mixed $pattern the id or the name of the pattern.:
1 string reference to 'patterns_unpublish_pattern'
- patterns_menu in ./
patterns.module - Implements hook_menu().
File
- includes/
servers.inc, line 216 - Functions related to importing and publishing patterns on the web.
Code
function patterns_unpublish_pattern($pattern) {
$pattern = patterns_utils_if_invalid_go_back($pattern);
$result = patterns_db_unpublish_pattern($pattern);
if ($result) {
drupal_set_message(t('Pattern %pattern was marked as private.', array(
'%pattern' => @$pattern->name,
)));
}
else {
drupal_set_message(t('An error occurred. Unable to mark pattern %pattern as private.', array(
'%pattern' => @$pattern->name,
)), 'error');
}
// Patterns API
// Invoke all the modules who wants to do something with the unpublished pattern
module_invoke_all('patterns_unpublish', $pattern);
drupal_goto('admin/patterns');
}