diff --git a/modules/opencase_cases/opencase_cases.module b/modules/opencase_cases/opencase_cases.module index 5bf6ae8..f439526 100644 --- a/modules/opencase_cases/opencase_cases.module +++ b/modules/opencase_cases/opencase_cases.module @@ -156,11 +156,14 @@ function _opencase_cases_redirect_to_home($form, &$form_state) { // Upon deletion of an activity, go to the related case if there is one, otherwise to its target. function _opencase_cases_delete_activity_redirect($form, &$form_state) { - if (!IsEmpty($form_state->getFormObject()->getEntity()->oc_case)) { - $case_id = $form_state->getFormObject()->getEntity()->oc_case->target_id; + $entity = $form_state->getFormObject()->getEntity(); + // for some reason this fires when deleting an activity type, shouldn't do but.s + if ($entity instanceof \Drupal\opencase_entities\Entity\OCActivityType) return; + if (!IsEmpty($entity->oc_case)) { + $case_id = $entity->oc_case->target_id; $form_state->setRedirect('entity.oc_case.canonical', ['oc_case' => $case_id]); } else { - $target_actor_id = $form_state->getFormObject()->getEntity()->oc_target->target_id; + $target_actor_id = $entity->oc_target->target_id; $form_state->setRedirect('entity.oc_actor.canonical', ['oc_actor' => $target_actor_id]); } } diff --git a/src/Plugin/Block/AddActivity.php b/src/Plugin/Block/AddActivity.php new file mode 100644 index 0000000..8150b5c --- /dev/null +++ b/src/Plugin/Block/AddActivity.php @@ -0,0 +1,37 @@ +getParameter('oc_actor')->id(); + $activity_types = \Drupal::service('entity_type.bundle.info')->getBundleInfo('oc_activity'); + $markup = ""; + return array('#markup' => $markup); + } + + public function getCacheMaxAge():int { + return 0; + } + +}