1

I'm looking for right steps to implement Global Filter module not as a block, but rather as an main menu links. The biggest problem is that each user can see only links they have access to (taxonomy access). So it's not possible to make these links static.

I've tried to include a block in the menu link, but that's not what I want.

Has anybody an idea where I could begin?

1
  • I came a little bit forward. I have placed Taxonomy menu exactly how i wanted. But now I only need to replace all automatic generated links taxonomy/term/$id to ?my_filter_field=$id. I can't find where I have to do it. It were very helpfull for me.
    – Peter C.
    Commented Sep 22, 2015 at 22:42

1 Answer 1

1

To rewrite your taxonomy URLs (you should probably rewrite your question to this end) you can use the following.

/*
 * Modify taxonomy uris to point back to facetted search
 */
function my_module_entity_info_alter(&$entity_info) {
  $entity_info['taxonomy_term']['uri callback'] = '_my_module_term_uri';
}

/**
 * Rewrite term URIs to point to our search query.
 */
function _my_module_term_uri($term) {
  $path = null;
  // Do your stuff to get your path correct.

  // Return your path if you've managed to rewrite it.
  if ( $path ) {
    return array(
      'path' => $path,
      'options' => array(), // url style options
    );
  }

  // Otherwise just return the default.
  return taxonomy_term_uri($term);
}
1
  • Thank you. I have found another possibility, but the redirect does not work at all. function test_entity_info_alter(&$entity_info) { $entity_info['taxonomy_term']['uri callback'] = 'test_taxonomy_term_uri'; } function test_taxonomy_term_uri($term) { switch ($term->vocabulary_machine_name) { case 'voc1': return array( 'path' => 'voc1/' . $term->tid, ); break; default: return array( 'path' => 'no_voc/' . $term->tid, ); break; } }
    – Peter C.
    Commented Sep 23, 2015 at 18:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.