function ContactStorageTestHooks::entityBaseFieldInfo

Implements hook_entity_base_field_info().

Attributes

#[Hook('entity_base_field_info')]

File

core/modules/contact/tests/modules/contact_storage_test/src/Hook/ContactStorageTestHooks.php, line 21

Class

ContactStorageTestHooks
Hook implementations for contact_storage_test.

Namespace

Drupal\contact_storage_test\Hook

Code

public function entityBaseFieldInfo(EntityTypeInterface $entity_type) : array {
  $fields = [];
  if ($entity_type->id() == 'contact_message') {
    $fields['id'] = BaseFieldDefinition::create('integer')->setLabel('Message ID')
      ->setDescription('The message ID.')
      ->setReadOnly(TRUE)
      ->setSetting('unsigned', TRUE);
  }
  return $fields;
}

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