You are here

function patterns_restore_pattern in Patterns 7

Same name and namespace in other branches
  1. 7.2 patterns.module \patterns_restore_pattern()

Restores a previously trashed pattern.

Sets the pattern status in the database to PATTERNS_STATUS_OK

Parameters

mixed $pid The ID of the Pattern to enable.:

1 string reference to 'patterns_restore_pattern'
patterns_menu in ./patterns.module
Implements hook_menu().

File

./patterns.module, line 561

Code

function patterns_restore_pattern($pid = NULL) {
  $pattern = patterns_utils_if_invalid_go_back($pid);
  $result = patterns_db_restore_pattern($pid);
  $params = array(
    '%name' => @$pattern->name,
  );
  if ($result) {
    drupal_set_message(t('Pattern %name was correctly restored from the trash bin.', $params));
  }
  else {
    drupal_set_message(t('An error occurred. Patterns was unable to restore pattern %name from the trash bin.', $params), 'error');
  }
  drupal_goto('admin/patterns');
}