function ContactStorageTestHooks::entityBaseFieldInfo

Implements hook_entity_base_field_info().

File

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

Class

ContactStorageTestHooks
Hook implementations for contact_storage_test.

Namespace

Drupal\contact_storage_test\Hook

Code

public function entityBaseFieldInfo(EntityTypeInterface $entity_type) {
    if ($entity_type->id() == 'contact_message') {
        $fields = [];
        $fields['id'] = BaseFieldDefinition::create('integer')->setLabel(t('Message ID'))
            ->setDescription(t('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.