Commit ea47329f authored by git's avatar git Committed by Dave Long
Browse files

Issue #1909542: Fixed taxonomy term catalog links should use hook_preprocess_link().

parent 9f156bb9
Loading
Loading
Loading
Loading
+5 −9
Changes for uc_catalog/uc_catalog.module: 5 added lines, 9 removed lines.
Original line number Diff line number Diff line
@@ -216,20 +216,16 @@ function uc_catalog_taxonomy_term_delete($term) {
}

/**
 * Implements hook_link_alter().
 * Implements hook_preprocess_link().
 *
 * Rewrites taxonomy term links to point to the catalog.
 */
function uc_catalog_link_alter(&$links, $node) {
function uc_catalog_preprocess_link(&$vars) {
  // Link back to the catalog and not the taxonomy term page.
  foreach ($links as $module => $link) {
    if (strstr($module, 'taxonomy_term')) {
      $tid = explode('_', $module);
      $tid = $tid[2];
      $term = taxonomy_term_load($tid);
  if (isset($vars['options']['entity_type']) && $vars['options']['entity_type'] == 'taxonomy_term') {
    $term = $vars['options']['entity'];
    if ($term->vid == variable_get('uc_catalog_vid', 0)) {
        $links[$module]['href'] = uc_catalog_path($term);
      }
      $vars['path'] = uc_catalog_path($term);
    }
  }
}