You are here

function lingotek_entity_delete_form in Lingotek Translation 7.6

Same name and namespace in other branches
  1. 7.7 lingotek.bulk_grid.inc \lingotek_entity_delete_form()
  2. 7.5 lingotek.bulk_grid.inc \lingotek_entity_delete_form()

Form constructor for the entity delete.

File

./lingotek.bulk_grid.inc, line 2030

Code

function lingotek_entity_delete_form($form, &$form_state, $nids = array(), $collapse_fieldset = TRUE) {
  if (isset($form_state['entity_ids'])) {
    $entity_ids = $form_state['entity_ids'];
    $collapse_fieldset = FALSE;
  }
  $form = array();
  if (!is_array($entity_ids)) {
    $entity_ids = array(
      $entity_ids,
    );
  }
  $entity_type = $form_state['entity_type'];
  $content_details_string = $entity_type . ' ' . t("entity ids") . ': ' . implode(", ", $entity_ids) . "<br/>";
  $form['confirm'] = array(
    '#type' => 'fieldset',
    '#prefix' => format_plural(count($entity_ids), '', '<div class="messages warning">' . t('This action will apply to @count entities.') . '</div>'),
    '#title' => t('Are you sure you want to delete these entities?'),
    '#description' => filter_xss($content_details_string),
    '#suffix' => '<i>' . t("Note: this action cannot be undone.") . '</i>',
    '#collapsible' => $collapse_fieldset,
    '#collapsed' => $collapse_fieldset,
  );
  $submit_function = $entity_type === 'config' ? 'lingotek_config_delete_form_submit' : 'lingotek_entity_delete_form_submit';
  $form['confirm']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Delete'),
    '#submit' => array(
      $submit_function,
    ),
  );
  $form['entity_ids'] = array(
    '#type' => 'hidden',
    '#value' => json_encode($entity_ids),
  );
  return $form;
}