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 2010
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;
    }
  }
}
doc_Drupal
2016-10-29 09:17:58
Comments
Leave a Comment

Please login to continue.