You are here

function patterns_restore_pattern_submit in Patterns 7.2

Executes patterns_db_restore_pattern($pid) and display a message.

See also

patterns_db_restore_pattern()

File

./patterns.module, line 505

Code

function patterns_restore_pattern_submit($form, &$form_state) {
  $pid = $form_state['values']['pid'];
  $name = $form_state['values']['name'];
  $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');
  }
  $form_state['redirect'] = 'admin/patterns';
}