You are here

function config_translation_test_form_config_translation_edit_form_alter in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/config_translation/tests/modules/config_translation_test/config_translation_test.module \config_translation_test_form_config_translation_edit_form_alter()
  2. 9 core/modules/config_translation/tests/modules/config_translation_test/config_translation_test.module \config_translation_test_form_config_translation_edit_form_alter()

Implements hook_form_FORM_ID_alter() for ConfigTranslationEditForm.

Adds a column to the configuration translation edit form that shows the current translation. Note that this column would not be displayed by default, as the columns are hardcoded in config_translation_manage_form_element.html.twig. The template would need to be overridden for the column to be displayed.

See also

\Drupal\config_translation\Form\ConfigTranslationEditForm

File

core/modules/config_translation/tests/modules/config_translation_test/config_translation_test.module, line 81
Configuration Translation Test module.

Code

function config_translation_test_form_config_translation_edit_form_alter(&$form, FormStateInterface $form_state) {
  if (\Drupal::state()
    ->get('config_translation_test_alter_form_alter')) {
    $form['#altered'] = TRUE;
  }
}