function FieldUiHooks::formFieldUiFieldStorageAddFormAlter

Implements hook_form_FORM_ID_alter() for 'field_ui_field_storage_add_form'.

Attributes

#[Hook('form_field_ui_field_storage_add_form_alter')]

File

core/modules/field_ui/src/Hook/FieldUiHooks.php, line 238

Class

FieldUiHooks
Hook implementations for field_ui.

Namespace

Drupal\field_ui\Hook

Code

public function formFieldUiFieldStorageAddFormAlter(array &$form) : void {
  $optgroup = (string) $this->t('Reference');
  // Move the "Entity reference" option to the end of the list and rename it
  // to "Other".
  unset($form['add']['new_storage_type']['#options'][$optgroup]['entity_reference']);
  $form['add']['new_storage_type']['#options'][$optgroup]['entity_reference'] = $this->t('Other…');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.