diff --git a/core/modules/field_ui/field_ui.module b/core/modules/field_ui/field_ui.module index 60b2d9d2650..7792ee85421 100644 --- a/core/modules/field_ui/field_ui.module +++ b/core/modules/field_ui/field_ui.module @@ -68,9 +68,7 @@ function field_ui_theme() { // include default form element classes. 'form_element__new_storage_type' => [ 'base hook' => 'form_element', - 'variables' => [ - 'variant' => NULL, - ], + 'render element' => 'element', ], ]; } @@ -227,25 +225,6 @@ function field_ui_form_field_ui_field_storage_add_form_alter(array &$form) { $form['add']['new_storage_type']['#options'][$optgroup]['entity_reference'] = t('Other…'); } -/** - * Implements hook_theme_suggestions_HOOK_alter(). - */ -function field_ui_theme_suggestions_form_element_alter(array &$suggestions, array $variables, $hook) { - // Create a template suggestions for radio items in the add field form. - if ($variables['element']['#type'] !== 'radio' || !isset($variables['element']['#name'])) { - return; - } - $names = [ - 'new_storage_type', - 'group_field_options_wrapper', - ]; - if (!in_array($variables['element']['#name'], $names, TRUE)) { - return; - } - - $suggestions[] = $hook . '__new_storage_type'; -} - /** * Implements hook_preprocess_HOOK(). */ diff --git a/core/modules/field_ui/src/Form/FieldStorageAddForm.php b/core/modules/field_ui/src/Form/FieldStorageAddForm.php index 6c7a17217cc..52d633a01d5 100644 --- a/core/modules/field_ui/src/Form/FieldStorageAddForm.php +++ b/core/modules/field_ui/src/Form/FieldStorageAddForm.php @@ -215,6 +215,7 @@ class FieldStorageAddForm extends FormBase { '#parents' => ['new_storage_type'], '#title_display' => 'before', '#description_display' => 'before', + '#theme_wrappers' => ['form_element__new_storage_type'], // If it is a category, set return value as the category label, // otherwise, set it as the field type id. '#return_value' => $display_as_group ? $val['category'] : $val['unique_identifier'], @@ -284,6 +285,7 @@ class FieldStorageAddForm extends FormBase { foreach ($unique_definitions[$selected_field_type] as $option_key => $option) { $radio_element = [ '#type' => 'radio', + '#theme_wrappers' => ['form_element__new_storage_type'], '#title' => $option['label']->render(), '#description' => [ '#theme' => 'item_list',