You are here

function lingotek_content_push_form_submit in Lingotek Translation 7.4

Same name and namespace in other branches
  1. 7.2 lingotek.module \lingotek_content_push_form_submit()
  2. 7.3 lingotek.module \lingotek_content_push_form_submit()

Submit handler for the lingotek_content_push_form form.

File

./lingotek.module, line 1588

Code

function lingotek_content_push_form_submit($form, $form_state) {
  $node = lingotek_node_load_default($form_state['values']['node_id']);
  $api = LingotekApi::instance();
  if ($existing_document = isset($node->lingotek['document_id']) ? $node->lingotek['document_id'] : NULL) {

    // Update an existing Lingotek Document.
    $api
      ->updateContentDocument(LingotekNode::load($node));
  }
  else {

    // Create a new Lingotek Document.
    $api
      ->addContentDocument(LingotekNode::load($node), TRUE);
  }
  drupal_set_message(t('Pushed content for @node_title to Lingotek for translation.', array(
    '@node_title' => $node->title,
  )));
}