Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I'm using latest PB code and latest ctools (7.x-1.2+45-dev) modules. I have the following configuration
$path_breadcrumb = new stdClass();
$path_breadcrumb->api_version = 1;
$path_breadcrumb->machine_name = 'file_add';
$path_breadcrumb->name = 'File add';
$path_breadcrumb->path = 'node/add/file';
$path_breadcrumb->data = array(
'titles' => array(
0 => '%site:current-user:name',
1 => 'Files',
2 => 'Add new file',
),
'paths' => array(
0 => 'user/%site:current-user:uid',
1 => 'user/%site:current-user:uid/files',
2 => '<none>',
),
'home' => 1,
'translatable' => 0,
'arguments' => array(
),
'access' => array(
),
);
$path_breadcrumb->weight = -100;
$export['file_add'] = $path_breadcrumb;
When I use this %site and everything related to it gets mapped to empty string. I traced this problem down to this snippet:
// Add custom ctools context for site.
$site = new ctools_context('site');
$site->plugin = 'site';
$site->keyword = 'site';
$contexts['site'] = $site;
PB calls ctools_context_keyword_substitute, which calls ctools_context_convert_context, which calls ctools_get_context($context->plugin) and gets a null (since there is no site plugin.
I tried to find a fix, but I'm not very familiar with the entire ctools system.
Cheers,
Andrei
Comment | File | Size | Author |
---|---|---|---|
#1 | path_breadcrumbs-add-site-name-subtitution-1954868.patch | 1.3 KB | rosberg |
Comments
Comment #1
rosberg CreditAttribution: rosberg commentedI was trying to use %site:name in my breadcrumb and experienced the same problem.
My temporary workaround was to create a new substitution token !site_name ( replaced by: variable_get('site_name') ). Attached is a patch for this, maybe it can help someone else.
Comment #2
Spleshka@abautu,
Thanks for report. Think that will be fixed soon.
@rosberg,
I can't accept your patch. We should fix all %site context here, not only %site:name token.
Comment #3
kalabroFixed it with ctools 'token' context: http://drupalcode.org/project/path_breadcrumbs.git/commitdiff/refs/heads...
Comment #4
kalabroFor multilevel tokens like
%site:current-user:name
waiting #1964434: Token context: tokens with deep more then 1 don't work to fix.Comment #5
kalabroShould be finally fixed in 7.x-3.0-beta5.