function tripal_entity_delete_form_submit

3.x TripalEntityUIController.inc tripal_entity_delete_form_submit($form, &$form_state)

Submit callback for tripal_entity_delete_form

1 string reference to 'tripal_entity_delete_form_submit'
tripal_entity_delete_form in tripal/includes/TripalEntityUIController.inc
Form callback: confirmation form for deleting a tripal_entity.

File

tripal/includes/TripalEntityUIController.inc, line 762

Code

function tripal_entity_delete_form_submit($form, &$form_state) {
  global $user;
  $entity = $form_state['entity'];

  if (!entity_access('delete', 'TripalEntity', $entity, $user)) {
    drupal_set_message(t('You do not have permission to delete this content.'), "error");
    $form_state['redirect'] = 'admin/content/bio_data';
    return;
  }

  $entity_controller = new TripalEntityController($entity->type);

  if ($entity_controller->delete(array($entity->id))) {
    drupal_set_message(t('The record title "%name" has been deleted.', array('%name' => $entity->title)));
    $form_state['redirect'] = 'admin/content/bio_data';
  }
  else {
    drupal_set_message(t('The tripal_entity %name was not deleted.', array('%name' => $entity->title)), "error");
  }
}