public static function LocalTask::baseFieldDefinitions

File

translators/tmgmt_local/src/Entity/LocalTask.php, line 58

Class

LocalTask
Entity class for the local task entity.

Namespace

Drupal\tmgmt_local\Entity

Code

public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
  $fields['tltid'] = BaseFieldDefinition::create('integer')
    ->setLabel(t('Local task ID'))
    ->setDescription(t('The local task ID.'))
    ->setReadOnly(TRUE)
    ->setSetting('unsigned', TRUE);
  $fields['tjid'] = BaseFieldDefinition::create('entity_reference')
    ->setLabel(t('Job'))
    ->setDescription(t('The Job for this task.'))
    ->setReadOnly(TRUE)
    ->setSetting('target_type', 'tmgmt_job')
    ->setDefaultValue(0);
  $fields['uuid'] = BaseFieldDefinition::create('uuid')
    ->setLabel(t('UUID'))
    ->setDescription(t('The node UUID.'))
    ->setReadOnly(TRUE);
  $fields['title'] = BaseFieldDefinition::create('string')
    ->setLabel(t('Title'))
    ->setDescription(t('The title of this local task.'))
    ->setDefaultValue('')
    ->setSettings(array(
    'max_length' => 255,
  ))
    ->setDisplayOptions('form', array(
    'type' => 'string',
    'weight' => -5,
  ))
    ->setDisplayConfigurable('form', TRUE);
  $fields['uid'] = BaseFieldDefinition::create('entity_reference')
    ->setLabel(t('Owner'))
    ->setDescription(t('The user that created the local task.'))
    ->setSettings(array(
    'target_type' => 'user',
  ))
    ->setDefaultValue(0);
  $fields['tuid'] = BaseFieldDefinition::create('entity_reference')
    ->setLabel(t('Assigned user'))
    ->setDescription(t('The user assigned to this task.'))
    ->setSettings(array(
    'target_type' => 'user',
  ))
    ->setDefaultValue(0);
  $fields['status'] = BaseFieldDefinition::create('integer')
    ->setLabel(t('Status'))
    ->setDescription(t('The local task status.'))
    ->setDefaultValue(static::STATUS_UNASSIGNED);
  $fields['loop_count'] = BaseFieldDefinition::create('integer')
    ->setLabel(t('Loop count'))
    ->setDescription(t('Counter for how many times task was returned to the assigned user.'))
    ->setDefaultValue(static::STATUS_UNASSIGNED);
  $fields['created'] = BaseFieldDefinition::create('created')
    ->setLabel(t('Created'))
    ->setDescription(t('The time that the job was created.'));
  $fields['changed'] = BaseFieldDefinition::create('changed')
    ->setLabel(t('Changed'))
    ->setDescription(t('The time that the job was last edited.'));
  return $fields;
}