public ContentLanguageSettingsForm::submitForm(array &$form, FormStateInterface $form_state)
Form submission handler.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Overrides FormInterface::submitForm
File
- core/modules/language/src/Form/ContentLanguageSettingsForm.php, line 145
Class
- ContentLanguageSettingsForm
- Configure the content language settings for this site.
Namespace
Drupal\language\Form
Code
1 2 3 4 5 6 7 8 9 10 11 | public function submitForm( array & $form , FormStateInterface $form_state ) { foreach ( $form_state ->getValue( 'settings' ) as $entity_type => $entity_settings ) { foreach ( $entity_settings as $bundle => $bundle_settings ) { $config = ContentLanguageSettings::loadByEntityTypeBundle( $entity_type , $bundle ); $config ->setDefaultLangcode( $bundle_settings [ 'settings' ][ 'language' ][ 'langcode' ]) ->setLanguageAlterable( $bundle_settings [ 'settings' ][ 'language' ][ 'language_alterable' ]) ->save(); } } drupal_set_message( $this ->t( 'Settings successfully updated.' )); } |
Please login to continue.