Hi --

Thanks for this handy module. Here is the issue I am having:

I go here: /taxonomy/vocabulary/1 and I get my list of terms for vocab = 1. All is good. I click on a term and it sends me here:

/vocabname/termname/subtermname/all and I get page not found.

My vocab is structure like this:

vocab -> many terms -> many subterms per term

Nodes may be assigned to any level in the vocabulary.

Please let me know what I can do to help solve this or to give you more information.

Thanks --

Missy.

Comments

thaiboxer’s picture

i'm having this problem also, not sure if its a list issue or views. The only place it is coming up for me is in taxonomy list though.

http://drupal.org/node/527068

thaiboxer’s picture

missy there is a option in taxonomy list to show children when clicked, this adds the /all to the end which is after pathauto does its thing.

nancydru’s picture

Status: Active » Postponed (maintainer needs more info)

Does that fix it for you?

verta’s picture

Component: Code » User Interface
Category: bug » feature
Status: Postponed (maintainer needs more info) » Active

I was having the same problem and this suggestion did fix it.

I have changed this issue to a feature request to add some text to the user interface to explain that the "Show children when clicked" option adds the string "all" to the link.

If there are no children, it actually might be nice to make a code feature to suppress adding "all" to this link, as it's making a link that will not work.

kenorb’s picture

Category: feature » bug

The same problem.
I've Display descendants, and links are wrong.
Like: /branża/auto-moto/autosalony/all
Page not found.

greg.1.anderson’s picture

Title: Link Problem » How to make "/all" work ("Show children when clicked") in taxonomy list
Category: bug » support
Status: Active » Needs review

The "Show children when clicked" option adds "/all" to the end of every link, but these links are broken by default. This is somewhat frustrating, because showing all of the children in a taxonomy list is the expected default behavior for hierarchical taxonomies. Variants on the Taxonomy hierarchy depth Judo Throw (a great article) did not help me here.

This is how I fixed it.

First, I added a pathauto_alias alter hook to create an alias for the "/all" links:

/**
 * Hook pathauto_alias alter.
 * See http://drupal.org/node/684132
 */
function MYMODULE_pathauto_alias_alter($alias, $context) {
  if (($context['op'] != 'return') && ($context['module'] == 'taxonomy') && (preg_match('#^taxonomy/term/[0-9]*$#', $context['source']))) {
    // If taxonomy made an alias from taxonomy/term/n to category/vocab/term,
    // Then we will make another from taxonomy/term/n/99 to category/vocab/term/all
    $path = array(
      'source' => $context['source'] . '/99',
      'alias' => $alias . '/all',
      'language' => $context['language'],
    );
    _pathauto_set_alias($path, $existing_alias, $context['op']);
  }
}

n.b. If you already have taxonomy terms created with aliases, you should visit admin/build/path/delete_bulk and delete all of your taxonomy term aliases. Then, head back over to https://dev.geni.rintra.net/admin/build/path/pathauto, expand the "Taxonomy term paths" and click on "Bulk generate aliases for terms that are not aliased" and submit the form. If you do this after you enable the code above, the extra taxonomy aliases will be created automatically.

After that, I also used a link alter hook to add the "/all" links to taxonomy terms in node headers and teasers:

/**
 * Hook link alter.
 * See http://drupal.org/node/684132
 */
function MYMODULE_link_alter(&$links, $node, $comment = NULL) {
  foreach ($links as $module => $link) {
    if (strstr($module, 'taxonomy_term') && (preg_match('#^taxonomy/term/[0-9]*$#', $link['href']))) {
      // Add depth '99' to taxonomy terms.  Note that in conjunction with the
      // hook pathauto_alias alter above, the presence of the created alias to
      // taxonomy/term/n/99 will cause Drupal to replace this href with the corresponding
      // alias (ending in '/all') from the URL alias table.
      $links[$module]['href'] .= '/99';
    }
  }
}

Works great; no Judo required, but still more work than I might hope for. Is there an easier way? Calling into the pathauto private function is not terribly elegant. If the technique above is, all the same, the best way to solve this problem, mark this issue 'fixed' and I will find a place in d.o. to move this documentation (php code snippets, maybe).

kenorb’s picture

Priority: Normal » Minor
Issue summary: View changes