You are here

public function RedhenContactTypeUIController::operationFormSubmit in RedHen CRM 7

Override parent to pass our delete entities flag in the delete op.

Overrides EntityDefaultUIController::operationFormSubmit

File

modules/redhen_contact/lib/redhen_contact_type.ui_controller.inc, line 54
Defines the EntityDefaultUIController for RedHen contacts.

Class

RedhenContactTypeUIController
Redhen Contact Type UI controller.

Code

public function operationFormSubmit($form, &$form_state) {
  if ($form_state['op'] == 'delete') {
    $entity = $form_state[$this->entityType];
    $delete_entities = $form_state['values']['delete_entities'];
    $entity
      ->delete($delete_entities);
    $label = entity_label($this->entityType, $entity);
    $msg = t('Successfully deleted contact type %label.', array(
      '%label' => $label,
    ));
    if ($delete_entities) {
      $msg = t('Successfully deleted contact type %label and all %label contacts.', array(
        '%label' => $label,
      ));
    }
    drupal_set_message($msg);
    $form_state['redirect'] = $this->path;
  }
  else {
    parent::operationFormSubmit($form, $form_state);
  }
}