function EntityTypeInfo::entityBaseFieldInfo
Same name in this branch
- 10 core/modules/content_moderation/src/EntityTypeInfo.php \Drupal\content_moderation\EntityTypeInfo::entityBaseFieldInfo()
Same name in other branches
- 9 core/modules/content_moderation/src/EntityTypeInfo.php \Drupal\content_moderation\EntityTypeInfo::entityBaseFieldInfo()
- 9 core/modules/workspaces/src/EntityTypeInfo.php \Drupal\workspaces\EntityTypeInfo::entityBaseFieldInfo()
- 8.9.x core/modules/content_moderation/src/EntityTypeInfo.php \Drupal\content_moderation\EntityTypeInfo::entityBaseFieldInfo()
- 8.9.x core/modules/workspaces/src/EntityTypeInfo.php \Drupal\workspaces\EntityTypeInfo::entityBaseFieldInfo()
- 11.x core/modules/content_moderation/src/EntityTypeInfo.php \Drupal\content_moderation\EntityTypeInfo::entityBaseFieldInfo()
- 11.x core/modules/workspaces/src/EntityTypeInfo.php \Drupal\workspaces\EntityTypeInfo::entityBaseFieldInfo()
- 11.x core/modules/workspaces/src/Hook/EntityTypeInfo.php \Drupal\workspaces\Hook\EntityTypeInfo::entityBaseFieldInfo()
Provides custom base field definitions for a content entity type.
Parameters
\Drupal\Core\Entity\EntityTypeInterface $entity_type: The entity type definition.
Return value
\Drupal\Core\Field\FieldDefinitionInterface[] An array of field definitions, keyed by field name.
See also
File
-
core/
modules/ workspaces/ src/ EntityTypeInfo.php, line 137
Class
- EntityTypeInfo
- Manipulates entity type information.
Namespace
Drupal\workspacesCode
public function entityBaseFieldInfo(EntityTypeInterface $entity_type) {
if ($this->workspaceInfo
->isEntityTypeSupported($entity_type)) {
$field_name = $entity_type->getRevisionMetadataKey('workspace');
$fields[$field_name] = BaseFieldDefinition::create('entity_reference')->setLabel(new TranslatableMarkup('Workspace'))
->setDescription(new TranslatableMarkup('Indicates the workspace that this revision belongs to.'))
->setSetting('target_type', 'workspace')
->setInternal(TRUE)
->setTranslatable(FALSE)
->setRevisionable(TRUE);
return $fields;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.