New activity gets its case from the url

This commit is contained in:
naomi
2018-04-30 17:14:51 +02:00
parent 59964e653e
commit 7cf4ee557b
3 changed files with 30 additions and 6 deletions

View File

@ -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')

View File

@ -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}
*/