Domanda

sto usando il modulo principale tassonomia per i tag del blog, ma quando nella pagina di un tag può ottenere solo il breadcrumb per apparire come 'casa', mentre mi piacerebbe idealmente essere 'Home> Blog> # # Tag' . Sto utilizzando il modulo breadcrumb personalizzato per briciole di pane impostati per i tipi di contenuto (<- non permette di pane grattugiato tassonomia) e ho provato utilizzando il modulo breadcrumb tassonomia senza alcun risultato, in parte a causa del fatto che non è un modulo particolarmente configurabile. pagine del blog di tag (che elencano tutti i nodi sotto un termine) sembrano essere generato dal modulo tassonomia di base e non viste in modo non riesco a risolvere il problema in vista.

Se qualcuno mi potrebbe punto nella giusta direzione sarei grato:)

È stato utile?

Soluzione

This sounds like something you could do relatively easy with drupal_set_breadcrumb in a custom module.

This is most likely what custom breadcrumb module is using itself. You will have to alter the breadcrumbs after custom breadcrumb module but before they are rendered. This might be what is giving your some problems with the taxonomy breadcrumb module.

You might be able to use it if you alter it's weight in system table, depinging on how the two modules alter the breadcrumbs. My guess is that it's done with hook_init

Altri suggerimenti

This can be accomplished by overriding theme_breadcrumb() in your theme's template.php An example implementation:

function mytheme_breadcrumb($breadcrumb) {

  if (arg(0) == 'taxonomy' && arg(1) == 'term' && is_numeric(arg(2))) {
    $breadcrumb = array();
    $breadcrumb[] = l(t('Home'), '<front>');
    $breadcrumb[] = l(t('Blog'), 'path/to/blog');

    $tid = arg(2);

    if ($term = taxonomy_term_load($tid)) {
      $uri = entity_uri('taxonomy_term', $term);
      $breadcrumb[] = l($term->name, $uri['path'], $uri['options']);
    }
  }

  // resume normal operation
  if (!empty($breadcrumb)) {
  // uncomment the next line to enable current page in the breadcrumb trail
    $title = drupal_get_title();
    if (!empty($title)) {
      $breadcrumb[] = $title;
      unset($title);
    }

    return '<div class="breadcrumb">'. implode(' &gt; ', $breadcrumb) . '</div>';
  }
}

There is a module for that (well more than one):

Probably would choose custom breadcrumbs due to its flexibility, and ability to craft breadcrumbs for the rest of your site as well.

I was having the same problem with taxonomies. I came across the module "Easy Breadcrumbs", which looks off of the URL construction to generate the breadcrumbs (relies on Pathauto and Clean URLs).

For example:

example.com/style/mediterranean

Home > Style > Mediterranean

I understand that in many cases this will not help, but if your breadcrumbs mimic your URL construction, then Easy Breadcrumbs should solve your problems.

I was using Taxonomy Display and found that drupal_set_breadcrumb() was failing on hook_init() and breadcrumb overrides were failing in other modules.

See this issue for a patch and offered solution to users of this module: breadcrumb handling makes it impossible to alter breadcrumbs for terms without parents

With Crumbs 7.x-2.x:

  1. Visit admin/structure/crumbs, and enable the taxonomy.* plugin wildcard, or sth more specific from the taxonomy plugin family. (it might already be enabled, but have a look to be sure)

  2. Go to admin/structure/crumbs/entity-parent/taxonomy-term, and set "blog" as the parent path for your chosen vocabulary.

  3. Visit admin/structure/crumbs, make sure that crumbs.entityParent.* (or something more specific) is enabled.

With Crumbs 7.x-1.x:

  1. Visit admin/structure/crumbs, and enable the taxonomy.* plugin wildcard, or sth more specific from the taxonomy plugin family. (it might already be enabled, but have a look to be sure)

  2. Write a custom module with a Crumbs plugin (*) that makes "blog" the parent path for "taxonomy/term/%taxonomy_term".

  3. Visit admin/structure/crumbs, enable your new plugin, and give it a priority weaker (further down) than the taxonomy.* or taxonomy.termParent.*.

(*) Writing the plugin: http://drupal.org/node/1398876
The example may be a bit overkill for this purpose, I hope you can find your way.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a drupal.stackexchange
scroll top