Get Field Name Being Deleted From Configuration Updates/Delete Form Trying to get the field_name being deleted when viewing a route like entity.field_config.user_field_delete_form.

Example path: /admin/config/people/accounts/fields/user.user.field_name/delete

Some Hooks I've tried:


hook_preprocess_html()
hook_preprocess_page()
hook_preprocess_page_title()
hook_preprocess_form_field_config_delete_form_alter()


But the best I have found is an argument [%label] =&gt; Field Label.

I have an array of field_names and want to check if the field_name being deleted matches one of the values.

The goal is to add a custom \Drupal::messenger()-&gt;addWanrning($warning);.

This would be altering an existing delete form/page.
Try with hook_form_alter something like 

/**
 * Implements hook_form_alter().
 */
function MyModule_form_alter(&amp;$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
  if ($form_id == "field_config_delete_form"){
    $field = $form_state-&gt;getFormObject()-&gt;getEntity();
    \Drupal::messenger()-&gt;addWarning("You are going to delete field : " . $field-&gt;getName());
  }
 }