function EntityTestHooks::entityExtraFieldInfo

Implements hook_entity_extra_field_info().

Attributes

#[Hook('entity_extra_field_info')]

File

core/modules/system/tests/modules/entity_test/src/Hook/EntityTestHooks.php, line 217

Class

EntityTestHooks
Hook implementations for entity_test.

Namespace

Drupal\entity_test\Hook

Code

public function entityExtraFieldInfo() : array {
  $extra['entity_test']['bundle_with_extra_fields'] = [
    'display' => [
      // Note: those extra fields do not currently display anything, they are
      // just used in \Drupal\Tests\field_ui\Kernel\EntityDisplayTest to test
      // the behavior of entity display objects.
'display_extra_field' => [
        'label' => $this->t('Display extra field'),
        'description' => $this->t('An extra field on the display side.'),
        'weight' => 5,
        'visible' => TRUE,
      ],
      'display_extra_field_hidden' => [
        'label' => $this->t('Display extra field (hidden)'),
        'description' => $this->t('An extra field on the display side, hidden by default.'),
        'visible' => FALSE,
      ],
    ],
  ];
  return $extra;
}

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