Added target field to activity
This commit is contained in:
@ -97,7 +97,14 @@ class OCActivity extends RevisionableContentEntityBase implements OCActivityInte
|
||||
$linked_actor = \Drupal\user\Entity\User::load(\Drupal::currentUser()->id())->field_linked_opencase_actor;
|
||||
if (empty($linked_actor)) return [];
|
||||
else return $linked_actor->target_id ;
|
||||
|
||||
}
|
||||
|
||||
public static function defaultTarget() {
|
||||
if (opencase_entities_get('target_id')) return [opencase_entities_get('target_id')];
|
||||
else return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
@ -244,6 +251,16 @@ class OCActivity extends RevisionableContentEntityBase implements OCActivityInte
|
||||
->setDefaultValueCallback('\Drupal\opencase_entities\Entity\OCActivity::loggedInActorId')
|
||||
->setDisplayConfigurable('form', true)
|
||||
->setDisplayConfigurable('view', true);
|
||||
|
||||
|
||||
$fields['oc_target'] = BaseFieldDefinition::create('entity_reference')
|
||||
->setLabel(t('Target'))
|
||||
->setRevisionable(TRUE)
|
||||
->setSetting('target_type', 'oc_actor')
|
||||
->setSetting('handler', 'default')
|
||||
->setDefaultValueCallback('\Drupal\opencase_entities\Entity\OCActivity::defaultTarget')
|
||||
->setDisplayConfigurable('form', true)
|
||||
->setDisplayConfigurable('view', true);
|
||||
|
||||
$fields['status'] = BaseFieldDefinition::create('boolean')
|
||||
->setLabel(t('Visible'))
|
||||
@ -294,15 +311,8 @@ class OCActivity extends RevisionableContentEntityBase implements OCActivityInte
|
||||
'text_processing' => 0,
|
||||
])
|
||||
->setDefaultValue('')
|
||||
->setDisplayOptions('view', [
|
||||
'label' => 'above',
|
||||
'type' => 'basic_string',
|
||||
'weight' => -1,
|
||||
])
|
||||
->setDisplayOptions('form', [
|
||||
'type' => 'string_textarea',
|
||||
'weight' => -1,
|
||||
])
|
||||
->setDisplayConfigurable('form', true)
|
||||
->setDisplayConfigurable('view', true)
|
||||
->setRequired(FALSE);
|
||||
|
||||
$fields['time_taken'] = BaseFieldDefinition::create('decimal')
|
||||
|
Reference in New Issue
Block a user