You are here

function patterns_trash_pattern_submit in Patterns 7.2

Same name and namespace in other branches
  1. 7 patterns.module \patterns_trash_pattern_submit()

Executes patterns_db_trash_pattern() and display a message.

See also

patterns_db_trash_pattern()

File

./patterns.module, line 550

Code

function patterns_trash_pattern_submit($form, &$form_state) {
  $pid = $form_state['values']['pid'];
  $name = $form_state['values']['name'];
  $id = !empty($name) ? $name : $pid;
  $result = patterns_db_trash_pattern($pid);
  if (!$result) {
    drupal_set_message(t('Pattern %id could not be moved into the trash bin.', array(
      '%id' => $id,
    )), 'error');
  }
  else {
    drupal_set_message(t('Pattern %id successfully moved into the trash bin.', array(
      '%id' => $id,
    )), 'status');
  }
  $form_state['redirect'] = 'admin/patterns';
}