Skip to content
Snippets Groups Projects

ISTWCMS-7078 The links of catalog category field in catalog item nodes work with ampersands

1 file
+ 23
9
Compare changes
  • Side-by-side
  • Inline
@@ -611,20 +611,34 @@ class UwNodeFieldValue {
break;
}
// Enusre that there is a tag.
// Ensure that there is a tag.
if (isset($tags[$key])) {
// Step through all the catalog category tags and
// fix to the correct UW URL.
foreach ($tags[$key] as $index => $value) {
// Since the drupal views uses the full title in the
// url (including all little keywords (the, is, all, of)
// we need to ensure that we include those in the url
// for the node.
$value['url'] = strtolower($value['title']);
$value['url'] = str_replace(' ', '-', $value['url']);
$tags[$key][$index]['url'] = $url . '/' . $value['url'];
// Use 'Transform term name based on pathauto' in
// catalog_by_category_page.
if ($key == 'Category') {
// Lookup the alias.
$alias_manager = \Drupal::service('path_alias.manager');
// Get alias.
$alias = $alias_manager->getAliasByPath('/taxonomy/term/' . $value['tid']);
$alias = str_replace('/catalogs/categories/', '', $alias);
$tags[$key][$index]['url'] = $url . '/' . $alias;
}
// Use 'Transform dashes in URL to spaces in term name
// filter values' in both catalog_by_audience_page
// and catalog_by_faculty_page.
else {
// Since the drupal views uses the full title in the
// url (including all little keywords (the, is, all, of)
// we need to ensure that we include those in the url
// for the node.
$value['url'] = strtolower($value['title']);
$value['url'] = str_replace(' ', '-', $value['url']);
$tags[$key][$index]['url'] = $url . '/' . $value['url'];
}
}
}
}
Loading