function EntitySchemaSubscriber::getWorkspaceFieldDefinition

Same name in other branches
  1. 9 core/modules/workspaces/src/EventSubscriber/EntitySchemaSubscriber.php \Drupal\workspaces\EventSubscriber\EntitySchemaSubscriber::getWorkspaceFieldDefinition()
  2. 8.9.x core/modules/workspaces/src/EventSubscriber/EntitySchemaSubscriber.php \Drupal\workspaces\EventSubscriber\EntitySchemaSubscriber::getWorkspaceFieldDefinition()
  3. 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);
}

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