public static function Epic::baseFieldDefinitions in Drupal PM (Project Management) 4.x
Returns an array of base field definitions for publishing status.
Parameters
\Drupal\Core\Entity\EntityTypeInterface $entity_type: The entity type to add the publishing status field to.
Return value
\Drupal\Core\Field\BaseFieldDefinition[] An array of base field definitions.
Throws
\Drupal\Core\Entity\Exception\UnsupportedEntityTypeDefinitionException Thrown when the entity type does not implement EntityPublishedInterface or if it does not have a "published" entity key.
Overrides WorkableItem::baseFieldDefinitions
File
- modules/
pm_epic/ src/ Entity/ Epic.php, line 65
Class
- Epic
- Defines the Epic entity.
Namespace
Drupal\pm_epic\EntityCode
public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
$fields = parent::baseFieldDefinitions($entity_type);
$fields['pm_feature'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('Feature'))
->setDescription('')
->setSetting('target_type', 'pm_feature')
->setSetting('handler', 'default')
->setDisplayOptions('view', [
'label' => 'hidden',
'type' => 'Issue',
'weight' => 0,
])
->setDisplayOptions('form', [
'type' => 'entity_reference_autocomplete',
'weight' => 5,
'settings' => [
'match_operator' => 'CONTAINS',
'size' => '60',
'autocomplete_type' => 'tags',
'placeholder' => '',
],
])
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE)
->setRequired(TRUE)
->setCardinality(FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED);
return $fields;
}