You are here

protected function EntitySchemaSubscriber::getWorkspaceFieldDefinition in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/workspaces/src/EventSubscriber/EntitySchemaSubscriber.php \Drupal\workspaces\EventSubscriber\EntitySchemaSubscriber::getWorkspaceFieldDefinition()
  2. 10 core/modules/workspaces/src/EventSubscriber/EntitySchemaSubscriber.php \Drupal\workspaces\EventSubscriber\EntitySchemaSubscriber::getWorkspaceFieldDefinition()

Gets the base field definition for the 'workspace' revision metadata field.

Return value

\Drupal\Core\Field\BaseFieldDefinition The base field definition.

1 call to EntitySchemaSubscriber::getWorkspaceFieldDefinition()
EntitySchemaSubscriber::addRevisionMetadataField in core/modules/workspaces/src/EventSubscriber/EntitySchemaSubscriber.php
Adds the 'workspace' revision metadata field to an entity type.

File

core/modules/workspaces/src/EventSubscriber/EntitySchemaSubscriber.php, line 151

Class

EntitySchemaSubscriber
Defines a class for listening to entity schema changes.

Namespace

Drupal\workspaces\EventSubscriber

Code

protected function getWorkspaceFieldDefinition() {
  return BaseFieldDefinition::create('entity_reference')
    ->setLabel($this
    ->t('Workspace'))
    ->setDescription($this
    ->t('Indicates the workspace that this revision belongs to.'))
    ->setSetting('target_type', 'workspace')
    ->setInternal(TRUE)
    ->setTranslatable(FALSE)
    ->setRevisionable(TRUE);
}