diff --git a/src/Plugin/Block/CaseDetails.php b/src/Plugin/Block/CaseDetails.php new file mode 100644 index 0000000..c7430b7 --- /dev/null +++ b/src/Plugin/Block/CaseDetails.php @@ -0,0 +1,58 @@ +getParameter('case_entity')->id(); + $case = $entity = \Drupal::entityTypeManager()->getStorage('case_entity')->load($case_id); + $markup .= $this->renderInvolvedParties($case); + $markup .= $this->renderEntity($case); + $markup .= $this->renderEditLink($case_id); + return [ + '#cache' => [ + 'max-age' => 0, + ], + '#markup' => $markup + ]; + + } + + private function renderEditLink($case_id) { + return ""; + } + + private function renderEntity($case) { + $view_builder = \Drupal::entityTypeManager()->getViewBuilder('case_entity'); + $build = $view_builder->view($case, 'default'); + return render($build); + } + + private function renderInvolvedParties($case) { + $markup = "

Involved Parties

"; + $hats_involved = $case->hats_involved->referencedEntities(); + foreach($hats_involved as $hat) { + $person_id = $hat->person->first()->getValue()['target_id']; + error_log($person_id); + $markup .= "

" . $hat->name->getString() . "

"; + } + return ""; + } + +} diff --git a/src/Plugin/Block/InvolvedParties.php b/src/Plugin/Block/InvolvedParties.php deleted file mode 100644 index ce40a1f..0000000 --- a/src/Plugin/Block/InvolvedParties.php +++ /dev/null @@ -1,40 +0,0 @@ -getParameter('case_entity')->id(); - $markup = ""; - - $case = $entity = \Drupal::entityTypeManager()->getStorage('case_entity')->load($case_id); - $hats_involved = $case->hats_involved->referencedEntities(); - foreach($hats_involved as $hat) { - $person_id = $hat->person->first()->getValue()['target_id']; - $markup .= "

" . $hat->name->getString() . "

"; - } - return [ - '#cache' => [ - 'max-age' => 0, - ], - '#markup' => "" - ]; - - } - -}