W3cubDocs

/Drupal 8

function hook_entity_extra_field_info_alter

hook_entity_extra_field_info_alter(&$info)

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\EntityManagerInterface::getExtraFields().

See also

hook_entity_extra_field_info()

Related topics

Hooks
Define functions that alter the behavior of Drupal core.

File

core/lib/Drupal/Core/Entity/entity.api.php, line 2013
Hooks and documentation related to entities.

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;
    }
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Entity!entity.api.php/function/hook_entity_extra_field_info_alter/8.1.x