function hook_entity_extra_field_info_alter

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Entity/entity.api.php \hook_entity_extra_field_info_alter()
  2. 8.9.x core/lib/Drupal/Core/Entity/entity.api.php \hook_entity_extra_field_info_alter()
  3. 11.x core/lib/Drupal/Core/Entity/entity.api.php \hook_entity_extra_field_info_alter()

Alter "pseudo-field" components on content entities.

Parameters

array $info: The array structure is identical to that of the return value of \Drupal\Core\Entity\EntityFieldManagerInterface::getExtraFields().

See also

hook_entity_extra_field_info()

Related topics

2 functions implement hook_entity_extra_field_info_alter()

Note: the procedural functions in this list are found by pattern matching, so the list may include some functions that are not actually implementations of this hook.

FieldTestHooks::entityExtraFieldInfoAlter in core/modules/field/tests/modules/field_test/src/Hook/FieldTestHooks.php
Implements hook_entity_extra_field_info_alter().
field_test_entity_extra_field_info_alter in core/modules/field/tests/modules/field_test/field_test.module
Implements hook_entity_extra_field_info_alter().

File

core/lib/Drupal/Core/Entity/entity.api.php, line 2300

Code

function hook_entity_extra_field_info_alter(&$info) {
  // Force node title to always be at the top of the list by default.
  foreach (NodeType::loadMultiple() as $bundle) {
    if (isset($info['node'][$bundle->id()]['form']['title'])) {
      $info['node'][$bundle->id()]['form']['title']['weight'] = -20;
    }
  }
}

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