interdiff impossible; taking evasive action reverted: --- b/core/lib/Drupal/Core/Form/FormBuilder.php +++ a/core/lib/Drupal/Core/Form/FormBuilder.php @@ -1000,22 +1000,6 @@ } $element['#processed'] = TRUE; } - $types_to_skip = [ - 'field_ui_table', - 'table', - 'tableselect', - 'hidden', - 'token', - 'value', - 'item', - 'datelist', - ]; - if (isset($element['#type']) && !in_array($element['#type'], $types_to_skip) && !empty($element['#input']) && empty($element['#attributes']['aria-labelledby'])) { - $title_key = in_array($element['#type'], ['button', 'submit']) ? '#value' : '#title'; - if (!isset($element[$title_key])) { - @trigger_error(sprintf('Form elements must have a #title attribute as of Drupal 9.0.0. Form element "%s" of #type "%s" from form "%s" is missing a #title attribute.', implode('][', $element['#array_parents']), $element['#type'], $form_id), E_USER_DEPRECATED); - } - } // We start off assuming all form elements are in the correct order. $element['#sorted'] = TRUE; unchanged: --- a/core/lib/Drupal/Core/Form/FormBuilder.php +++ b/core/lib/Drupal/Core/Form/FormBuilder.php @@ -1008,6 +1008,22 @@ public function doBuildForm($form_id, &$element, FormStateInterface &$form_state } $element['#processed'] = TRUE; } + $types_to_skip = [ + 'field_ui_table', + 'table', + 'tableselect', + 'hidden', + 'token', + 'value', + 'item', + 'datelist', + ]; + if (isset($element['#type']) && !in_array($element['#type'], $types_to_skip) && !empty($element['#input']) && empty($element['#attributes']['aria-labelledby'])) { + $title_key = in_array($element['#type'], ['button', 'submit']) ? '#value' : '#title'; + if (!isset($element[$title_key])) { + @trigger_error(sprintf('Form elements must have a #title attribute as of Drupal 9.0.0. Form element "%s" of #type "%s" from form "%s" is missing a #title attribute.', implode('][', $element['#array_parents']), $element['#type'], $form_id), E_USER_DEPRECATED); + } + } // We start off assuming all form elements are in the correct order. $element['#sorted'] = TRUE; diff -u b/core/modules/book/src/Form/BookAdminEditForm.php b/core/modules/book/src/Form/BookAdminEditForm.php --- b/core/modules/book/src/Form/BookAdminEditForm.php +++ b/core/modules/book/src/Form/BookAdminEditForm.php @@ -223,8 +223,6 @@ $form[$id]['title'] = [ '#prefix' => !empty($indentation) ? \Drupal::service('renderer')->render($indentation) : '', - '#title' => $this->t('Title'), - '#title_display' => 'invisible', '#type' => 'textfield', '#default_value' => $data['link']['title'], '#maxlength' => 255, @@ -242,6 +240,8 @@ $form[$id]['title'] = [ '#prefix' => !empty($indentation) ? \Drupal::service('renderer')->render($indentation) : '', + '#title' => $this->t('Title'), + '#title_display' => 'invisible', '#type' => 'textfield', '#default_value' => $data['link']['title'], '#maxlength' => 255, diff -u b/core/modules/field_ui/src/Form/EntityDisplayFormBase.php b/core/modules/field_ui/src/Form/EntityDisplayFormBase.php --- b/core/modules/field_ui/src/Form/EntityDisplayFormBase.php +++ b/core/modules/field_ui/src/Form/EntityDisplayFormBase.php @@ -448,22 +448,22 @@ if (!empty($settings_form) || !empty($third_party_settings_form)) { $field_row['settings_edit'] = $base_button + [ '#type' => 'image_button', + '#title' => $this->t('Edit'), '#name' => $field_name . '_settings_edit', '#src' => 'core/misc/icons/787878/cog.svg', - '#attributes' => ['class' => ['field-plugin-settings-edit'], 'alt' => $this->t('Edit')], + // The title will be copied to the 'alt' tag in + // \Drupal\Core\Render\Element\ImageButton::preRenderButton(), so + // there's no need to do it here. + '#attributes' => ['class' => ['field-plugin-settings-edit']], '#op' => 'edit', // Do not check errors for the 'Edit' button, but make sure we get // the value of the 'plugin type' select. if (!empty($settings_form) || !empty($third_party_settings_form)) { $field_row['settings_edit'] = $base_button + [ '#type' => 'image_button', - '#title' => $this->t('Edit'), '#name' => $field_name . '_settings_edit', '#src' => 'core/misc/icons/787878/cog.svg', - // The title will be copied to the 'alt' tag in - // \Drupal\Core\Render\Element\ImageButton::preRenderButton(), so - // there's no need to do it here. - '#attributes' => ['class' => ['field-plugin-settings-edit']], + '#attributes' => ['class' => ['field-plugin-settings-edit'], 'alt' => $this->t('Edit')], '#op' => 'edit', // Do not check errors for the 'Edit' button, but make sure we get // the value of the 'plugin type' select. diff -u b/core/modules/language/src/Form/ContentLanguageSettingsForm.php b/core/modules/language/src/Form/ContentLanguageSettingsForm.php --- b/core/modules/language/src/Form/ContentLanguageSettingsForm.php +++ b/core/modules/language/src/Form/ContentLanguageSettingsForm.php @@ -137,7 +137,8 @@ foreach ($bundles[$entity_type_id] as $bundle => $bundle_info) { $form['settings'][$entity_type_id][$bundle]['settings'] = [ '#type' => 'item', - '#label' => $bundle_info['label'], + '#title' => $bundle_info['label'], + '#title_display' => 'invisible', 'language' => [ '#type' => 'language_configuration', '#entity_information' => [ @@ -148,8 +149,7 @@ foreach ($bundles[$entity_type_id] as $bundle => $bundle_info) { $form['settings'][$entity_type_id][$bundle]['settings'] = [ '#type' => 'item', - '#title' => $bundle_info['label'], - '#title_display' => 'invisible', + '#label' => $bundle_info['label'], 'language' => [ '#type' => 'language_configuration', '#entity_information' => [ diff -u b/core/modules/node/src/Plugin/Search/NodeSearch.php b/core/modules/node/src/Plugin/Search/NodeSearch.php --- b/core/modules/node/src/Plugin/Search/NodeSearch.php +++ b/core/modules/node/src/Plugin/Search/NodeSearch.php @@ -846,7 +846,8 @@ $form['content_ranking']['rankings'][$var]['value'] = [ '#type' => 'select', '#options' => $options, - '#attributes' => ['aria-label' => $this->t("Influence of '@title'", ['@title' => $values['title']])], + '#title' => $this->t("Influence of '@title'", ['@title' => $values['title']]), + '#title_display' => 'invisible', '#default_value' => $this->configuration['rankings'][$var] ?? 0, ]; } @@ -856,9 +857,8 @@ ]; $form['content_ranking']['rankings'][$var]['value'] = [ '#type' => 'select', - '#title' => $this->t("Influence of '@title'", ['@title' => $values['title']]), - '#title_display' => 'invisible', '#options' => $options, + '#attributes' => ['aria-label' => $this->t("Influence of '@title'", ['@title' => $values['title']])], '#default_value' => isset($this->configuration['rankings'][$var]) ? $this->configuration['rankings'][$var] : 0, ]; }