public static function JobItem::baseFieldDefinitions

File

src/Entity/JobItem.php, line 73

Class

JobItem
Entity class for the tmgmt_job_item entity.

Namespace

Drupal\tmgmt\Entity

Code

public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
  $fields['tjiid'] = BaseFieldDefinition::create('integer')
    ->setLabel(t('Job Item ID'))
    ->setDescription(t('The Job Item ID.'))
    ->setReadOnly(TRUE)
    ->setSetting('unsigned', TRUE);
  $fields['tjid'] = BaseFieldDefinition::create('entity_reference')
    ->setLabel(t('Job'))
    ->setDescription(t('The Job.'))
    ->setReadOnly(TRUE)
    ->setSetting('target_type', 'tmgmt_job')
    ->setDefaultValue(0);
  $fields['uuid'] = BaseFieldDefinition::create('uuid')
    ->setLabel(t('UUID'))
    ->setDescription(t('The job item UUID.'))
    ->setReadOnly(TRUE);
  $fields['plugin'] = BaseFieldDefinition::create('string')
    ->setLabel(t('Plugin'))
    ->setDescription(t('The plugin of this job item.'))
    ->setSettings(array(
    'max_length' => 255,
  ));
  $fields['item_type'] = BaseFieldDefinition::create('string')
    ->setLabel(t('Item Type'))
    ->setDescription(t('The item type of this job item.'))
    ->setSettings(array(
    'max_length' => 255,
  ));
  $fields['item_id'] = BaseFieldDefinition::create('string')
    ->setLabel(t('Item ID'))
    ->setDescription(t('The item ID of this job item.'))
    ->setSettings(array(
    'max_length' => 255,
  ));
  $fields['data'] = BaseFieldDefinition::create('string_long')
    ->setLabel(t('Data'))
    ->setDescription(t('The source data'));
  $states = static::getStates();
  $fields['state'] = BaseFieldDefinition::create('list_integer')
    ->setLabel(t('Job item state'))
    ->setDescription(t('The job item state'))
    ->setSetting('allowed_values', $states)
    ->setDefaultValue(static::STATE_INACTIVE);
  $fields['translator_state'] = BaseFieldDefinition::create('string')
    ->setLabel(t('Translator job item state'));
  $fields['changed'] = BaseFieldDefinition::create('changed')
    ->setLabel(t('Changed'))
    ->setDescription(t('The time that the job was last edited.'));
  $fields['count_pending'] = BaseFieldDefinition::create('integer')
    ->setLabel(t('Pending count'))
    ->setSetting('unsigned', TRUE);
  $fields['count_translated'] = BaseFieldDefinition::create('integer')
    ->setLabel(t('Translated count'))
    ->setSetting('unsigned', TRUE);
  $fields['count_reviewed'] = BaseFieldDefinition::create('integer')
    ->setLabel(t('Reviewed count'))
    ->setSetting('unsigned', TRUE);
  $fields['count_accepted'] = BaseFieldDefinition::create('integer')
    ->setLabel(t('Accepted count'))
    ->setSetting('unsigned', TRUE);
  $fields['word_count'] = BaseFieldDefinition::create('integer')
    ->setLabel(t('Word count'))
    ->setSetting('unsigned', TRUE);
  $fields['tags_count'] = BaseFieldDefinition::create('integer')
    ->setLabel(t('Tags count'))
    ->setSetting('unsigned', TRUE);
  $fields['file_count'] = BaseFieldDefinition::create('integer')
    ->setLabel(t('File count'))
    ->setSetting('unsigned', TRUE);
  return $fields;
}