You are here

function _field_defaults_translation_submit in Field Defaults 7.2

Same name and namespace in other branches
  1. 7 field_defaults.module \_field_defaults_translation_submit()

Submit handler for field ui translation form

1 string reference to '_field_defaults_translation_submit'
field_defaults_form_i18n_string_translate_page_form_alter in ./field_defaults.module
Implements hook_form_FORM_ID_alter().

File

./field_defaults.module, line 213
field_defaults.module

Code

function _field_defaults_translation_submit($form, &$form_state) {
  $update_defaults = $form_state['values']['update_defaults'];

  // @TODO: Again, some pretty hacky ways to get at this data
  if ($update_defaults) {

    // Setup batch
    $batch = $form_state['values']['field_defaults_batch'];
    $batch['languages'] = array(
      $form_state['values']['langcode'] => $form_state['values']['langcode'],
    );
    $batch['field_translation'] = TRUE;
    $batch['no_overwrite'] = $form_state['values']['update_defaults_no_overwrite'];
    $key = 'field:' . $batch['field'] . ':' . $batch['bundle'] . ':default_value';
    if (isset($form_state['values']['strings'][$key])) {
      $batch['default_value'] = array(
        array(
          'value' => $form_state['values']['strings'][$key],
        ),
      );
      field_defaults_batch_run($batch);
    }
  }
}