You are here

function lingotek_publish_form_submit in Lingotek Translation 7.4

Same name and namespace in other branches
  1. 7.7 lingotek.page.inc \lingotek_publish_form_submit()
  2. 7.2 lingotek.page.inc \lingotek_publish_form_submit()
  3. 7.3 lingotek.page.inc \lingotek_publish_form_submit()
  4. 7.5 lingotek.page.inc \lingotek_publish_form_submit()
  5. 7.6 lingotek.page.inc \lingotek_publish_form_submit()

Submit handler for the lingotek_publish_form form. Update the entity_translation module publishing fields

File

./lingotek.page.inc, line 342
Lingotek Tab for Nodes

Code

function lingotek_publish_form_submit($form, $form_state) {
  if (module_exists('entity_translation')) {
    $node = lingotek_node_load_default($form_state['values']['node_id']);
    $status_request = $form_state['triggering_element']['#id'] == 'publish' ? 1 : 0;
    $language_codes = $form_state['values']['languages'];
    list($languages_updated, $updates) = lingotek_entity_translation_save_status($node, $language_codes, $status_request);
    $publish_status_text = $status_request ? 'published' : 'unpublished';
    $languages_updated_html = "<ul><li>" . implode("</li><li>", $languages_updated) . "</li></ul>";
    if ($updates > 0) {
      drupal_set_message(t('The following languages have been <b><i>@publish_status_text</i></b>: ' . $languages_updated_html, array(
        '@publish_status_text' => $publish_status_text,
        '@languages_updated_html' => $languages_updated_html,
      )));

      //'@node_title' => $node->title,
    }
    else {
      drupal_set_message(t('Nothing was changed, since no languages were selected'));
    }
  }
}