You are here

function lingotek_entity_disassociate_form in Lingotek Translation 7.6

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

Form constructor for the entity disassociate form. (Formerly "Reset Translations")

1 string reference to 'lingotek_entity_disassociate_form'
lingotek_disassociate_nodes in ./lingotek.bulk_grid.inc
Callback function to disassociate translations for multiple nodes at a time

File

./lingotek.bulk_grid.inc, line 2121

Code

function lingotek_entity_disassociate_form($form, $form_state, $entity_ids = array(), $collapse_fieldset = TRUE) {
  if (isset($form_state['entity_ids']) && empty($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'];
  $form['disassociate_translations'] = array(
    '#type' => 'fieldset',
    '#prefix' => format_plural(count($entity_ids), '', '<div class="messages warning">' . t('This action will apply to @count entities.') . '</div>'),
    '#title' => t('Disassociate Translations'),
    '#description' => t("Disassociates the entity translations on Lingotek's servers from the copies downloaded to Drupal. Additional translation using Lingotek will require re-uploading the entity to restart the translation process. <br/><br/>"),
    '#suffix' => $note = $entity_type === 'config' ? '<span style="color:red"><b><i>' . t("Note: Deleting documents on the TMS will affect all strings in the associated config sets.") . '<b><i></span>' : '<i>' . t("Note: This action should only be used to change the Lingotek project or TM vault associated with the entities.") . '<i>',
    '#collapsible' => $collapse_fieldset,
    '#collapsed' => $collapse_fieldset,
  );
  $form['disassociate_translations']['confirm'] = array(
    '#type' => 'checkbox',
    '#title' => t('Also remove all document(s) from Lingotek TMS'),
    '#default_value' => FALSE,
  );
  $submit_function = $entity_type === 'config' ? 'lingotek_config_disassociate_form_submit' : 'lingotek_entity_disassociate_form_submit';
  $form['disassociate_translations']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Disassociate Translations'),
    '#submit' => array(
      $submit_function,
    ),
  );
  $form['entity_ids'] = array(
    '#type' => 'hidden',
    '#value' => json_encode($entity_ids),
  );
  return $form;
}