\Drupal::currentUser()->id(), ]; } /** * {@inheritdoc} */ public function getCreatedTime() { return NULL; } /** * {@inheritdoc} */ public function getChangedTime() { return NULL; } /** * {@inheritdoc} */ public function getOwner() { return NULL; } /** * {@inheritdoc} */ public function getOwnerId() { return $this->get('user_id')->target_id; } /** * {@inheritdoc} */ public function setOwnerId($uid) { $this->set('user_id', $uid); return $this; } /** * {@inheritdoc} */ public function setOwner(UserInterface $account) { $this->set('user_id', $account->id()); return $this; } /** * Get the completed time for the process. */ public function getCompletedTime() { return NULL; } /** * {@inheritdoc} * * Field properties defined here. */ 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; } }