diff --git a/modules/opencase_no_cases/src/Plugin/Block/ContextualMenu.php b/modules/opencase_no_cases/src/Plugin/Block/ContextualMenu.php deleted file mode 100644 index 7cebec0..0000000 --- a/modules/opencase_no_cases/src/Plugin/Block/ContextualMenu.php +++ /dev/null @@ -1,65 +0,0 @@ -getRouteName(); - \Drupal::logger('my_module')->error(\Drupal::routeMatch()->getParameter('oc_actor')->bundle()); - if ($route_name == 'entity.oc_actor.canonical' && \Drupal::routeMatch()->getParameter('oc_actor')->bundle() == 'client' ) { - $markup = $this->actorPage(); - $build = []; - $build['contextual_menu'] = [ - '#markup' => "
$markup ['max-age' => 0] - ]; - return $build; - } - } - - - /** - * Contextual menu for Actor page - * - Links to add activities of various types - */ - private function actorPage() { - $actor_id = \Drupal::routeMatch()->getParameter('oc_actor')->id(); - return $this->generateLinksForAddingNewActivities("Add activity", $actor_id); - } - /** - * returns html markup. - */ - private function generateLinksForAddingNewActivities($title, $actor_id) { - $title = t($title); - $markup = "

$title: "; - $allActivityTypes = \Drupal::service('entity_type.bundle.info')->getBundleInfo('oc_activity'); - $redirect_destination = \Drupal\Core\Url::fromRoute("entity.oc_actor.canonical", ['oc_actor' => $actor_id])->toString(); - foreach($allActivityTypes as $machine_name => $activityType) { - $label = $activityType['label']; - $url = \Drupal\Core\Url::fromRoute("entity.oc_activity.add_form", ['oc_activity_type' => $machine_name]); - $url->setOption('query', ['actor_id' => $actor_id, 'destination' => $redirect_destination]); - $link = \Drupal\Core\Link::fromTextAndUrl($label, $url)->toString(); - $markup .= "   $link"; - } - $markup .= "

"; - return ""; - } -}