You are here

public static function MaestroProcessVariables::baseFieldDefinitions in Maestro 8.2

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

Field properties defined here.

Overrides ContentEntityBase::baseFieldDefinitions

File

src/Entity/MaestroProcessVariables.php, line 119

Class

MaestroProcessVariables
Defines the MaestroProcessVariables entity.

Namespace

Drupal\maestro\Entity

Code

public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {

  // Auto increment process ID.
  $fields['id'] = BaseFieldDefinition::create('integer')
    ->setLabel(t('id'))
    ->setDescription(t('The ID of the Maestro Process Variable.'))
    ->setReadOnly(TRUE);
  $fields['process_id'] = BaseFieldDefinition::create('entity_reference')
    ->setLabel(t('Process ID'))
    ->setDescription(t('The process ID this variable belongs to.'))
    ->setSetting('target_type', 'maestro_process')
    ->setSetting('handler', 'default');

  // The name of the variable.  This comes from the template originally.
  $fields['variable_name'] = BaseFieldDefinition::create('string')
    ->setLabel(t('Name'))
    ->setDescription(t('The name of the variable.'))
    ->setSettings([
    'default_value' => '',
    'max_length' => 255,
    'text_processing' => 0,
  ]);

  // The value of the variable.
  $fields['variable_value'] = BaseFieldDefinition::create('string')
    ->setLabel(t('Value'))
    ->setDescription(t('The value of the variable.'))
    ->setSettings([
    'default_value' => '',
    'max_length' => 255,
    'text_processing' => 0,
  ]);
  return $fields;
}