New activity gets its case from the url
This commit is contained in:
@ -74,6 +74,13 @@ class OCActivity extends RevisionableContentEntityBase implements OCActivityInte
|
||||
|
||||
use EntityChangedTrait;
|
||||
|
||||
/**
|
||||
* When creating an activity, it sets the case id from the URL.
|
||||
*/
|
||||
public static function defaultVal() {
|
||||
return \Drupal::request()->query->get('case_id');;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
@ -267,6 +274,7 @@ class OCActivity extends RevisionableContentEntityBase implements OCActivityInte
|
||||
'placeholder' => '',
|
||||
],
|
||||
])
|
||||
->setDefaultValueCallback('Drupal\opencase_entities\Entity\OCActivity::defaultVal')
|
||||
->setRequired(TRUE);
|
||||
|
||||
$fields['status'] = BaseFieldDefinition::create('boolean')
|
||||
|
@ -72,6 +72,7 @@ use Drupal\user\UserInterface;
|
||||
*/
|
||||
class OCCase extends RevisionableContentEntityBase implements OCCaseInterface {
|
||||
|
||||
use EntityChangedTrait;
|
||||
|
||||
/**
|
||||
* When creating a case, it sets the first involved party to the actor
|
||||
@ -81,8 +82,6 @@ class OCCase extends RevisionableContentEntityBase implements OCCaseInterface {
|
||||
return \Drupal::request()->query->get('actor_id');;
|
||||
}
|
||||
|
||||
use EntityChangedTrait;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
Reference in New Issue
Block a user