You are here

public static function MaestroProcessStatus::baseFieldDefinitions in Maestro 8.2

Same name and namespace in other branches
  1. 3.x src/Entity/MaestroProcessStatus.php \Drupal\maestro\Entity\MaestroProcessStatus::baseFieldDefinitions()

Field properties defined here.

Overrides ContentEntityBase::baseFieldDefinitions

File

src/Entity/MaestroProcessStatus.php, line 118

Class

MaestroProcessStatus
Defines the MaestroProcessStatus entity.

Namespace

Drupal\maestro\Entity

Code

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

  // Auto increment ID.
  $fields['id'] = BaseFieldDefinition::create('integer')
    ->setLabel(t('id'))
    ->setDescription(t('The unique ID of the Maestro Process Status entry.'))
    ->setReadOnly(TRUE);

  // relation/entity ref to process.
  $fields['process_id'] = BaseFieldDefinition::create('entity_reference')
    ->setLabel(t('Process ID'))
    ->setDescription(t('The process ID this status belongs to.'))
    ->setSetting('target_type', 'maestro_process')
    ->setSetting('handler', 'default');

  // The numerical stage for the message.  This comes from the template tasks originally.
  $fields['stage_number'] = BaseFieldDefinition::create('integer')
    ->setLabel(t('Stage Number'))
    ->setDescription(t('The integer stage number.'));

  // The message associated to the stage number.
  $fields['stage_message'] = BaseFieldDefinition::create('string')
    ->setLabel(t('Stage Message'))
    ->setDescription(t('The status message to show for this stage.'))
    ->setSettings([
    'default_value' => '',
    'max_length' => 255,
    'text_processing' => 0,
  ]);

  // Completion time stamp.
  $fields['completed'] = BaseFieldDefinition::create('integer')
    ->setLabel(t('Completed'))
    ->setDescription(t('The time that the task associated to this status was completed.'))
    ->setSettings([
    'default_value' => '0',
  ]);
  return $fields;
}