I hope the answer would come in handy for other users, maybe it could become an episode for your screencast :)
I have a taxonomy browsing section with quite a simple 2-level URL scheme:
site.com/langcode/products/%manufacturer/
site.com/langcode/products/%manufacturer/%productwhere manufacturer is a taxonomy term name (transliterated) and the product is a node title (transliterated). Both patterns are governed by Pathauto. So, for this path:
site.com/langcode/walt-disney/winnie-the-pooh
I should have breadcrumbs like:
[Home] > [Products] > [Walt Disney] > Winnie the Pooh
The product node "Winnie the Pooh" is an instance of a content type Product.
As much I could understand the PB philosophy, I created a definition like the one below, but could not get it to work when browsing through my products section. Any advice as per why, please?
How do I convert transliterated names from paths into human names needed for titles? (Currently I put identical values just to get anything).
$path_breadcrumb = new stdClass();
$path_breadcrumb->api_version = 1;
$path_breadcrumb->machine_name = 'producenci';
$path_breadcrumb->name = 'Producenci';
$path_breadcrumb->path = 'produkty/%manufacturer/%product';
$path_breadcrumb->data = array(
'titles' => array(
0 => '%manufacturer:name',
1 => '%product:title',
),
'paths' => array(
0 => '%manufacturer:name',
1 => '%product:title',
),
'home' => 1,
'translatable' => 1,
'arguments' => array(
'manufacturer' => array(
'position' => 1,
'argument' => 'term',
'settings' => array(
'identifier' => 'Taxonomy term: ID',
'input_form' => 'term',
'vids' => array(
2 => '2',
1 => 0,
),
'breadcrumb' => 0,
'transform' => 0,
),
),
'product' => array(
'position' => 2,
'argument' => 'entity_id:node',
'settings' => array(
'identifier' => 'Node: ID',
),
),
),
'access' => array(),
);
$path_breadcrumb->weight = 0;
Comments
Comment #0.0
moniuch commentedfixed code formatting
Comment #0.1
moniuch commentedfixed language
Comment #1
kalabronode/%product_nodenode/%product_nodethere is only one argument — Node: IDnode/%/devel/tokenpage.To use
[node:field-term-manufacturer:name]you should input%product_node:field-term-manufacturer:nameaccording to your argument.To use
[node:field-term-manufacturer:url:path]you should input%product_node:field-term-manufacturer:url:pathand so on.Comment #2
moniuch commentedThanks a lot, your explanation that it works on real URLs rather than aliases cleared a lot.
It'd be useful to place that info on the definition form.
Comment #3
moniuch commentedWould you please explain just one more thing.
I found a context labeled String, end the explanation says:
If checked, this string will include all arguments. For example, if the path is "path/%" and the user visits "path/foo/bar", if this is not checked the string will be "foo". If it is checked the string will be "foo/bar".After what you've explained about the URL aliases, path/foo/bar would never be allowed on the system unless it were an alias. So when would this kind of context be called?
I find myself defining a bunch of simple breadcrumbs which fit a pattern like: site.com/pagetitle (some can be of a certain content type, others are views pages). I was wondering if this sort of breadcrumbs could be addressed by one definition?
Comment #4
kalabroNow it is allowed :) The module is really flexible.
Comment #5
moniuch commentedYes, that's true, congratulations!
I understood the path/foo/bar thing right after I made breadcrumbs for a Views page.
Thanks for your patient support, Closing the issue.
Comment #6
kalabroGlad to help! You're welcome to prepare most common questions for documentation!
Comment #7
moniuch commentedI sent an email to Evgeniy with my observations as a beginner, this might guide you in writing a FAQ section.
Comment #7.0
moniuch commentedprovided node title