added linked actor of logged in user to new case

This commit is contained in:
naomi 2018-07-09 12:11:07 +02:00
parent 667b109de8
commit 2a31b1c8ce

View File

@ -76,10 +76,13 @@ class OCCase extends RevisionableContentEntityBase implements OCCaseInterface {
/**
* When creating a case, it sets the first involved party to the actor
* id from the URL.
* id from the URL, and the second to the author's linked actor
* (if it exists and is different)
*/
public static function defaultVal() {
return array(\Drupal::request()->query->get('actor_id'));
$author_linked_actor_id = \Drupal\user\Entity\User::load(\Drupal::currentUser()->id())->get('field_linked_opencase_actor')->target_id;
$currently_viewed_actor_id = \Drupal::request()->query->get('actor_id');
return array_unique([$currently_viewed_actor_id, $author_linked_actor_id]);
}
/**