diff --git a/src/Service/UWService.php b/src/Service/UWService.php index 2135ab3718ccb4a2df20f76d1b3491c03d2fc1b1..d107c1edb58b6cbbd08a0643e24994d92b0b0326 100644 --- a/src/Service/UWService.php +++ b/src/Service/UWService.php @@ -105,7 +105,7 @@ class UWService implements UWServiceInterface { /** * {@inheritDoc} */ - public function uwGetNodeContent(Node $node, string $content_type, string $view_mode, string $content = 'all'): array { + public function uwGetNodeContent(Node $node, string $view_mode, string $content = 'all'): array { // Flags for getting teaser content. $get_header = FALSE; @@ -134,9 +134,9 @@ class UWService implements UWServiceInterface { } // Setup the teaser data array, based on flags. - switch ($content_type) { + switch ($node->getType()) { - case 'blog': + case 'uw_ct_blog': // The list of tags for blogs. $tag_list = [ @@ -155,7 +155,7 @@ class UWService implements UWServiceInterface { ]; break; - case 'events': + case 'uw_ct_event': // The list of tags for events. $tag_list = [ @@ -174,7 +174,7 @@ class UWService implements UWServiceInterface { ]; break; - case 'news': + case 'uw_ct_news_item': // The list of tags for news. $tag_list = [ @@ -193,13 +193,13 @@ class UWService implements UWServiceInterface { break; } - return $this->uwGetNodeData($node, $content_type, $view_mode, $content_data); + return $this->uwGetNodeData($node, $view_mode, $content_data); } /** * {@inheritDoc} */ - public function uwGetNodeData(Node $node, string $content_type, string $view_mode, array $content_data): array { + public function uwGetNodeData(Node $node, string $view_mode, array $content_data): array { // Array to store the teaser data, need blank // array in case there is no data to return. @@ -228,7 +228,7 @@ class UWService implements UWServiceInterface { case 'date': if ($view_mode == 'teaser') { - if ($content_type !== 'events') { + if ($node->getType() !== 'events') { $node_data['date'] = date('l, F j, Y', strtotime($node->$data->value)); } else { diff --git a/src/Service/UWServiceInterface.php b/src/Service/UWServiceInterface.php index 56a786d5cbd2a9af8286a76246d597d6fc819d36..844ee6cc93b22a0eba20f1052c62d9af0c7edd57 100644 --- a/src/Service/UWServiceInterface.php +++ b/src/Service/UWServiceInterface.php @@ -33,8 +33,6 @@ interface UWServiceInterface { * * @param \Drupal\node\Node $node * Node entity. - * @param string $content_type - * The content type (i.e. news, event, blog, etc). * @param string $view_mode * The view mode (i.e. node, teaser, etc). * @param string $content @@ -43,15 +41,13 @@ interface UWServiceInterface { * @return array * Array of variables and their values. */ - public function uwGetNodeContent(Node $node, string $content_type, string $view_mode, string $content = 'all'): array; + public function uwGetNodeContent(Node $node, string $view_mode, string $content = 'all'): array; /** * Gets teaser data. * * @param \Drupal\node\Node $node * Node entity. - * @param string $content_type - * The content type (i.e. news, event, blog, etc). * @param string $view_mode * The view mode (i.e. node, teaser, etc). * @param array $content_data @@ -60,7 +56,7 @@ interface UWServiceInterface { * @return array * Array of node values. */ - public function uwGetNodeData(Node $node, string $content_type, string $view_mode, array $content_data): array; + public function uwGetNodeData(Node $node, string $view_mode, array $content_data): array; /** * A function to get or check the attached sidebar.