Skip to content

Commit

Permalink
Remove select2 help text on screen names
Browse files Browse the repository at this point in the history
Order doesn't matter for screen names.
  • Loading branch information
xendk committed Dec 6, 2024
1 parent 92ded1f commit 7a89ef3
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions web/modules/custom/dpl_event/dpl_event.module
Original file line number Diff line number Diff line change
Expand Up @@ -313,11 +313,19 @@ function dpl_event_form_alter(array &$form, FormStateInterface $form_state, stri
return;
}

if (\Drupal::config(SettingsForm::CONFIG_NAME)->get('enable_screen_name')) {
if (!isset($form['field_screen_names'])) {
return;
}

if (isset($form['field_screen_names'])) {
$form['field_screen_names']['#access'] = FALSE;
// Undo select2s adding of help text.
if (isset($form['field_screen_names']['widget']['#description']['#items'])) {
$form['field_screen_names']['widget']['#description'] =
$form['field_screen_names']['widget']['#description']['#items'][0];
}

if (\Drupal::config(SettingsForm::CONFIG_NAME)->get('enable_screen_name')) {
return;
}

$form['field_screen_names']['#access'] = FALSE;
}

0 comments on commit 7a89ef3

Please sign in to comment.