Compare commits

...
This repository has been archived on 2022-07-12. You can view files and clone it, but cannot push or open issues or pull requests.

3 Commits
master ... dev

2 changed files with 20 additions and 22 deletions

View File

@ -66,10 +66,9 @@ function opencase_cases_entity_base_field_info($entity_type) {
return $fields;
}
/**
* When creating an activity, it sets the case id from the URL.
*/
function opencase_cases_default_activity_case_value() {
/* When creating an activity, it sets the case id from the URL.
/*/
public static function opencase_cases_default_activity_case_value() {
return array(\Drupal::request()->query->get('case_id'));
}
@ -90,11 +89,11 @@ function opencase_cases_form_alter(&$form, &$form_state, $form_id) {
function _opencase_cases_redirect_to_home($form, &$form_state) {
$form_state->setRedirect('<front>');
}
function _opencase_cases_delete_activity_redirect($form, &$form_state) {
$case_id = $form_state->getFormObject()->getEntity()->oc_case->target_id;
$form_state->setRedirect('entity.oc_case.canonical', ['oc_case' => $case_id]);
}
/**
* Implements hook_theme_suggestions_HOOK().
*/

View File

@ -26,7 +26,6 @@ function opencase_no_cases_help($route_name, RouteMatchInterface $route_match) {
function opencase_no_cases_entity_base_field_info($entity_type) {
if ($entity_type->id() === 'oc_activity') {
$fields = array();
$fields['actors_involved'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('Participants'))
->setDescription(t('People involved in this activity. To add one, start typing their name.'))
@ -51,9 +50,9 @@ function opencase_no_cases_entity_base_field_info($entity_type) {
])
->setDefaultValueCallback('opencase_no_cases_actors_involved_callback')
->setRequired(TRUE);
}
return $fields;
}
}
/**
* When creating an activity, it sets the first involved party to the actor