From fad009aeff0a2d3d8aef0c18122bbcdaf4598e56 Mon Sep 17 00:00:00 2001 From: ppound Date: Fri, 10 Sep 2021 15:17:58 -0300 Subject: [PATCH] Use content types label not machine name for calendar title --- src/Controller/CalendarController.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Controller/CalendarController.php b/src/Controller/CalendarController.php index f184246..c27883b 100644 --- a/src/Controller/CalendarController.php +++ b/src/Controller/CalendarController.php @@ -36,7 +36,16 @@ class CalendarController extends ControllerBase { public function calendarTitle($ebundle) { $bundle = ebundle_split($ebundle, 'bundle'); - return t('@bundle Calendar', array('@bundle' => ucwords($bundle))); + $titlePrefix = $bundle; + $entityTypeManager = \Drupal::service('entity_type.manager'); + $contentTypes = $entityTypeManager->getStorage('node_type')->loadMultiple(); + foreach ($contentTypes as $contentType) { + if($contentType->id() == $bundle) { + $titlePrefix = $contentType->label(); + break; + } + } + return t('@bundle Calendar', array('@bundle' => ucwords($titlePrefix))); } private function getBundleCalendar($ebundle, $selected_month = null, $selected_day = null) {