You are here

function lingotek_advanced_parsing_upgrade_form in Lingotek Translation 7.2

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

Form constructor for parsing upgrade of a node.

Return value

array A FAPI form array.

1 string reference to 'lingotek_advanced_parsing_upgrade_form'
lingotek_pm in ./lingotek.page.inc
Page callback for the Lingotek local task on node detail pages.

File

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

Code

function lingotek_advanced_parsing_upgrade_form($form_state) {
  $form = array();
  if (!variable_get('lingotek_advanced_parsing', FALSE)) {
    $router_item = menu_get_item();
    if (!empty($router_item['page_arguments'][0]->nid)) {
      $node_id = $router_item['page_arguments'][0]->nid;
      $form['node_id'] = array(
        '#type' => 'hidden',
        '#value' => $node_id,
      );
      $form['advanced_parsing_upgrade'] = array(
        '#type' => 'fieldset',
        '#title' => t('Advanced Content Parsing'),
        '#description' => t('Your site is currently set to use legacy ("simple") content parsing. Use the button below to upgrade this node to advanced content parsing.'),
        '#collapsible' => TRUE,
        '#collapsed' => TRUE,
      );
      $advanced_parsing = lingotek_lingonode($node_id, 'use_advanced_parsing');
      if (empty($advanced_parsing)) {
        $form['advanced_parsing_upgrade']['submit'] = array(
          '#type' => 'submit',
          '#value' => t('Upgrade node'),
        );
      }
      else {
        $form['advanced_parsing_upgrade']['already_upgraded'] = array(
          '#markup' => t('This node has already been upgraded to use advanced parsing.'),
        );
      }
    }
    else {
      watchdog('lingotek', 'Unable to locate node ID for advanced parsing upgrade form: @path', array(
        '@path' => $_GET['q'],
      ), WATCHDOG_ERROR);
    }
  }
  return $form;
}