You are here

public static function MaestroProcess::baseFieldDefinitions in Maestro 3.x

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

Field properties defined here.

Overrides ContentEntityBase::baseFieldDefinitions

File

src/Entity/MaestroProcess.php, line 122

Class

MaestroProcess
Defines the MaestroProcess entity.

Namespace

Drupal\maestro\Entity

Code

public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {

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

  // UUID for the process (really required?  perhaps for cross site comparison purposes)
  $fields['uuid'] = BaseFieldDefinition::create('uuid')
    ->setLabel(t('UUID'))
    ->setDescription(t('The UUID of the Maestro Process entity.'))
    ->setReadOnly(TRUE);

  // The name for the process.  Carried over by the template.
  $fields['process_name'] = BaseFieldDefinition::create('string')
    ->setLabel(t('Process Name'))
    ->setDescription(t('The Process Name. Carried from the Template.'))
    ->setSettings([
    'default_value' => '',
    'max_length' => 255,
    'text_processing' => 0,
  ]);

  // The machine name (id) of the template being.
  $fields['template_id'] = BaseFieldDefinition::create('string')
    ->setLabel(t('Template Machine Name/ID'))
    ->setDescription(t('Machine name of the template.'))
    ->setSettings([
    'default_value' => '',
    'max_length' => 255,
    'text_processing' => 0,
  ]);

  // Completion flag
  // 0 is incomplete.  1 is complete.
  $fields['complete'] = BaseFieldDefinition::create('integer')
    ->setLabel(t('Complete Flag'))
    ->setDescription(t('Completion flag'))
    ->setSettings([
    'default_value' => '0',
  ]);

  // Initiator UID.  The UID of the person who started it.
  // 0 for Maestro.  This is also mimicked in the initiator variable.
  $fields['initiator_uid'] = BaseFieldDefinition::create('integer')
    ->setLabel(t('User ID of the initiator.'))
    ->setDescription(t('Initiator User ID'))
    ->setSettings([
    'default_value' => '0',
  ]);
  $fields['created'] = BaseFieldDefinition::create('created')
    ->setLabel(t('Created'))
    ->setDescription(t('The time that the process was created.'));
  $fields['changed'] = BaseFieldDefinition::create('changed')
    ->setLabel(t('Changed'))
    ->setDescription(t('The time that the process entity was last edited.'));
  $fields['completed'] = BaseFieldDefinition::create('integer')
    ->setLabel(t('Completed'))
    ->setDescription(t('The time that the process was completed.'))
    ->setSettings([
    'default_value' => '0',
  ]);
  return $fields;
}