You are here

function globallink_form_entity_translation_translatable_form_submit in GlobalLink Connect for Drupal 7.5

Same name and namespace in other branches
  1. 7.7 globallink.module \globallink_form_entity_translation_translatable_form_submit()
  2. 7.6 globallink.module \globallink_form_entity_translation_translatable_form_submit()
1 string reference to 'globallink_form_entity_translation_translatable_form_submit'
globallink_form_entity_translation_translatable_form_alter in ./globallink.module

File

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

Code

function globallink_form_entity_translation_translatable_form_submit(&$form, $form_state) {
  $field_name = $form_state['field']['field_name'];
  $bundle = $form_state['field']['bundles'];
  $entity_keys = array_keys($bundle);
  $entity_type = $entity_keys[0];
  $content_type = $form_state['field']['bundles'][$entity_type][0];
  if (!globallink_check_field_configured($content_type, $entity_type, $content_type, $field_name)) {
    return;
  }

  //Check if the field translation has been disabled, and remove it from the globallink field configurations as well.
  $field_translatable = $form_state['field']['translatable'];
  if ($field_translatable == 1) {
    db_delete('globallink_field_config')
      ->condition('field_name', $field_name, '=')
      ->condition('entity_type', $entity_type, '=')
      ->condition('bundle', $content_type, '=')
      ->condition('content_type', $content_type, '=')
      ->execute();
  }
}