diff --git a/src/Service/UwNodeFieldValue.php b/src/Service/UwNodeFieldValue.php index 6d1ffa410135da43c0543002916183b4b50d946d..35b6579d52fb5a5d16fa13bfa42f0aafd7ac7303 100644 --- a/src/Service/UwNodeFieldValue.php +++ b/src/Service/UwNodeFieldValue.php @@ -705,6 +705,9 @@ class UwNodeFieldValue { 'uw_ct_event' => 'events', 'uw_ct_news_item' => 'news', 'uw_ct_opportunity' => 'opportunities', + 'uw_ct_profile' => 'profiles', + 'uw_ct_project' => 'projects/search', + 'uw_ct_service' => 'services', ]; // Get the content type name. @@ -726,28 +729,61 @@ class UwNodeFieldValue { 'field_uw_opportunity_type' => 'opportunity_type', 'field_uw_opportunity_employment' => 'employment_type', 'field_uw_opportunity_pay_type' => 'rate_of_pay', + 'field_uw_ct_profile_type' => 'type', + 'field_uw_project_status' => 'status', + 'field_uw_project_topics' => 'audience', + 'field_uw_service_audience' => 'audience', + 'field_uw_service_category' => 'categories', ]; // Step through each of the tags and get the // correct url. foreach ($tags as $index => $tag) { - // Start the url to the content type listing page. - $new_url = '/' . $content_type_list[$content_type]; - $new_url .= '?'; + // Start the url to the content type listing page, service + // category does not require the content type after the /. + if ($tag['field_name'] !== 'field_uw_service_category') { + $new_url = '/' . $content_type_list[$content_type]; + } + else { + $new_url = ''; + } // If the tag is in the list of field names to convert, // then convert them using the url provided, if not use // the field name with tags. if (array_key_exists($tag['field_name'], $tag_field_names)) { - $new_url .= $tag_field_names[$tag['field_name']]; + + // If this is not a service tag, add the query parameters. + // Services require a special url, so we will take care + // of that later. + if ( + $tag['field_name'] !== 'field_uw_service_audience' && + $tag['field_name'] !== 'field_uw_service_category' + ) { + $new_url .= '?' . $tag_field_names[$tag['field_name']]; + } } else { - $new_url .= 'tags'; + $new_url .= '?tags'; } - // Add the tid to the new url. - $new_url .= '[' . $tag['tid'] . ']=' . $tag['tid']; + // Add the tid to the new url, projects status requires + // the non array for tid. + if ($tag['field_name'] == 'field_uw_project_status') { + $new_url .= '=' . $tag['tid']; + } + // If this is a service, just use the url to the term. + elseif ( + $tag['field_name'] == 'field_uw_service_audience' || + $tag['field_name'] == 'field_uw_service_category' + ) { + $new_url .= $tag['url']; + } + // Add the array tid query parameter. + else { + $new_url .= '[' . $tag['tid'] . ']=' . $tag['tid']; + } // Set the new url. $tags[$index]['url'] = $new_url;