You are here

function add_to_globallink_cart_submit in GlobalLink Connect for Drupal 7.7

Submit function of the Add to submission button in node edit page.

1 string reference to 'add_to_globallink_cart_submit'
globallink_form_alter in ./globallink.module
Implements hook_form_alter().

File

./globallink.module, line 1853
GlobalLink translation module.

Code

function add_to_globallink_cart_submit(&$form, &$form_state) {
  $form_state['redirect'] = FALSE;
  module_load_include('inc', 'globallink', 'globallink');
  $node_types = globallink_get_translatable_node_types(TRUE);
  $result = db_select(GLOBALLINK_ENTITY_TYPE_NODE, 'n')
    ->fields('n', array(
    'nid',
    'vid',
    'type',
  ))
    ->condition('nid', arg(1), '=')
    ->execute();
  foreach ($result as $row) {
    if (in_array($row->type, $node_types)) {
      $_SESSION['nids'][$row->nid . '-' . $row->vid] = $row->nid . '-' . $row->vid;
    }
    else {
      $_SESSION['eids'][$row->nid . '-' . $row->vid] = $row->nid . '-' . $row->vid;
    }
  }
  drupal_set_message(t('Content added to Globallink Submission.'));
  $_REQUEST['destination'] = 'node/' . arg(1) . '/edit';
}