protected function LingotekSettingsTabPreferencesForm::saveShowLanguageFields in Lingotek Translation 8        
                          
                  
                        Same name and namespace in other branches
- 8.2 src/Form/LingotekSettingsTabPreferencesForm.php \Drupal\lingotek\Form\LingotekSettingsTabPreferencesForm::saveShowLanguageFields()
 - 4.0.x src/Form/LingotekSettingsTabPreferencesForm.php \Drupal\lingotek\Form\LingotekSettingsTabPreferencesForm::saveShowLanguageFields()
 - 3.0.x src/Form/LingotekSettingsTabPreferencesForm.php \Drupal\lingotek\Form\LingotekSettingsTabPreferencesForm::saveShowLanguageFields()
 - 3.1.x src/Form/LingotekSettingsTabPreferencesForm.php \Drupal\lingotek\Form\LingotekSettingsTabPreferencesForm::saveShowLanguageFields()
 - 3.2.x src/Form/LingotekSettingsTabPreferencesForm.php \Drupal\lingotek\Form\LingotekSettingsTabPreferencesForm::saveShowLanguageFields()
 - 3.3.x src/Form/LingotekSettingsTabPreferencesForm.php \Drupal\lingotek\Form\LingotekSettingsTabPreferencesForm::saveShowLanguageFields()
 - 3.4.x src/Form/LingotekSettingsTabPreferencesForm.php \Drupal\lingotek\Form\LingotekSettingsTabPreferencesForm::saveShowLanguageFields()
 - 3.5.x src/Form/LingotekSettingsTabPreferencesForm.php \Drupal\lingotek\Form\LingotekSettingsTabPreferencesForm::saveShowLanguageFields()
 - 3.6.x src/Form/LingotekSettingsTabPreferencesForm.php \Drupal\lingotek\Form\LingotekSettingsTabPreferencesForm::saveShowLanguageFields()
 - 3.7.x src/Form/LingotekSettingsTabPreferencesForm.php \Drupal\lingotek\Form\LingotekSettingsTabPreferencesForm::saveShowLanguageFields()
 - 3.8.x src/Form/LingotekSettingsTabPreferencesForm.php \Drupal\lingotek\Form\LingotekSettingsTabPreferencesForm::saveShowLanguageFields()
 
 
1 call to LingotekSettingsTabPreferencesForm::saveShowLanguageFields()
  - LingotekSettingsTabPreferencesForm::submitForm in src/Form/LingotekSettingsTabPreferencesForm.php
 
  - Form submission handler.
 
 
File
 
   - src/Form/LingotekSettingsTabPreferencesForm.php, line 296
 
  
  Class
  
  - LingotekSettingsTabPreferencesForm 
 
  - Configure Lingotek
 
  Namespace
  Drupal\lingotek\Form
Code
protected function saveShowLanguageFields($form_values) {
  
  if ($this->lingotek
    ->get('preference.show_language_labels') != $form_values['show_language_labels']) {
    $bundles = \Drupal::entityManager()
      ->getBundleInfo('node');
    foreach ($bundles as $bundle_id => $bundle) {
      if ($bundle['translatable']) {
        $field_definitions = \Drupal::entityManager()
          ->getFieldDefinitions('node', $bundle_id);
        $langcode = $field_definitions['langcode'];
        $display = entity_get_display('node', $bundle_id, 'default');
        if ($form_values['show_language_labels']) {
          $component_values = array(
            'type' => 'language',
            'weight' => 0,
            'settings' => array(),
            'third_party_settings' => array(),
            'label' => 'above',
          );
          $display
            ->setComponent('langcode', $component_values);
        }
        else {
          $display
            ->removeComponent('langcode');
        }
        $display
          ->save();
      }
    }
  }
  $this->lingotek
    ->set('preference.show_language_labels', $form_values['show_language_labels']);
}