You are here

public static function WorkflowScheduledTransition::baseFieldDefinitions in Workflow 8

Define the fields. Modify the parent fields.

Overrides WorkflowTransition::baseFieldDefinitions

File

src/Entity/WorkflowScheduledTransition.php, line 219

Class

WorkflowScheduledTransition
Implements a scheduled transition, as shown on Workflow form.

Namespace

Drupal\workflow\Entity

Code

public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
  $fields = [];

  // Add the specific ID-field : tid vs. hid.
  $fields['tid'] = BaseFieldDefinition::create('integer')
    ->setLabel(t('Transition ID'))
    ->setDescription(t('The transition ID.'))
    ->setReadOnly(TRUE)
    ->setSetting('unsigned', TRUE);

  // Get the rest of the fields.
  $fields += parent::baseFieldDefinitions($entity_type);

  // The timestamp has a different description.
  $fields['timestamp'] = [];

  // Reset old value.
  $fields['timestamp'] = BaseFieldDefinition::create('created')
    ->setLabel(t('Scheduled'))
    ->setDescription(t('The date+time this transition is scheduled for.'))
    ->setRevisionable(TRUE);

  // Remove the specific ID-field : tid vs. hid.
  unset($fields['hid']);
  return $fields;
}