function WorkspacesTestHooks::entityBaseFieldInfo

Implements hook_entity_base_field_info().

Attributes

#[Hook('entity_base_field_info')]

File

core/modules/workspaces/tests/modules/workspaces_test/src/Hook/WorkspacesTestHooks.php, line 43

Class

WorkspacesTestHooks
Hook implementations for workspaces_test.

Namespace

Drupal\workspaces_test\Hook

Code

public function entityBaseFieldInfo(EntityTypeInterface $entity_type) : array {
  $fields = [];
  // Add the workspace revision field test to entity_test_mulrevpub.
  if ($entity_type->id() === 'entity_test_mulrevpub') {
    $fields['revision_test_field'] = BaseFieldDefinition::create('revision_test_field')->setLabel(new TranslatableMarkup('Workspace Revision Field Test'))
      ->setDescription(new TranslatableMarkup('A test field that tracks isNewRevision() status during field presave.'))
      ->setRevisionable(TRUE);
  }
  return $fields;
}

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