8.5.x entity.api.php hook_entity_extra_field_info()
8.0.x entity.api.php hook_entity_extra_field_info()
8.1.x entity.api.php hook_entity_extra_field_info()
8.2.x entity.api.php hook_entity_extra_field_info()
8.3.x entity.api.php hook_entity_extra_field_info()
8.4.x entity.api.php hook_entity_extra_field_info()
8.6.x entity.api.php hook_entity_extra_field_info()

Exposes "pseudo-field" components on content entities.

Field UI's "Manage fields" and "Manage display" pages let users re-order fields, but also non-field components. For nodes, these include elements exposed by modules through hook_form_alter(), for instance.

Content entities or modules that want to have their components supported should expose them using this hook. The user-defined settings (weight, visible) are automatically applied when entities or entity forms are rendered.

Return value

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

See also


Related topics

8 functions implement hook_entity_extra_field_info()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

aggregator_entity_extra_field_info in core/modules/aggregator/aggregator.module
Implements hook_entity_extra_field_info().
comment_entity_extra_field_info in core/modules/comment/comment.module
Implements hook_entity_extra_field_info().
contact_entity_extra_field_info in core/modules/contact/contact.module
Implements hook_entity_extra_field_info().
content_moderation_entity_extra_field_info in core/modules/content_moderation/content_moderation.module
Implements hook_entity_extra_field_info().
content_translation_entity_extra_field_info in core/modules/content_translation/content_translation.module
Implements hook_entity_extra_field_info().

... See full list


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


function hook_entity_extra_field_info() {
  $extra = array();
  $module_language_enabled = \Drupal::moduleHandler()
  $description = t('Node module element');
  foreach (NodeType::loadMultiple() as $bundle) {

    // Add also the 'language' select if Language module is enabled and the
    // bundle has multilingual support.
    // Visibility of the ordering of the language selector is the same as on the
    // node/add form.
    if ($module_language_enabled) {
      $configuration = ContentLanguageSettings::loadByEntityTypeBundle('node', $bundle
      if ($configuration
        ->isLanguageAlterable()) {
          ->id()]['form']['language'] = array(
          'label' => t('Language'),
          'description' => $description,
          'weight' => 0,
      ->id()]['display']['language'] = array(
      'label' => t('Language'),
      'description' => $description,
      'weight' => 0,
      'visible' => FALSE,
  return $extra;