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.
if i use the standard breadcrumbs everything works fine.
i use the Omega Theme Omega 7.x-3.1. If I disable the breadcrumbs in the "Toggle advanced elements" the breadcrumbs block is available as block that I can move to different regions. But then the path breadcrumbs don't work anymore.
Comments
Comment #1
Elijah LynnI don't think they will work together, Delta uses a different template for breadcrumbs.
Comment #2
ruthverena75 CreditAttribution: ruthverena75 commentedi tried different ways to move the breadcrumbs to a own block and use the path breadcrumbs inside, but didn't succeed. i would be very happy if anybody would have a solution for this. meanwhile i trick it with absolute positioning with css.
Comment #3
SpleshkaJust use this snippet in your custom block:
Comment #4
SpleshkaClosing this issue. Please, feel free to reopen it if you have any questions.
Comment #5
anniegreens CreditAttribution: anniegreens commentedI cannot get path breadcrumbs to output anywhere but in the default theme placed location.
After trying to use the Delta block without success, and finding this issue queue, I added a block with the exact code provided above in a custom module with other hook-related overrides whose module weight is higher than path_breadcrumbs. The result is the same -- the default non-path_breadcrumb-provided breadcrumbs, basically just 'Home'.
Your hook_page_alter(), running drupal_set_breadcrumb, is running after my hook_block() that is running drupal_get_breadcrumb. Is there something else I'm missing here?
Comment #6
anniegreens CreditAttribution: anniegreens commentedAfter a bit of debugging I was able to get the code to work in a hook_preprocess_block function. Basically, to get the breadcrumbs placed specifically in certain regions on certain pages, context is needed for placing the block. The block content is then overridden in the preprocess function after the hook_page_alter where the path_breadcrumb is set. Hope this helps someone else that comes to find this thread.
Comment #8
twigley CreditAttribution: twigley commentedHi anniegreens,
I'm having exactly the same issue, not being able to move breadcrumbs, but don't seem to be able to fix it by using the above.
I've tried adding the above code to a preprocess file, but it doesnt seem to make any difference.
Could you give a bit more detail?
Would really appreciate it.
Cheers
Comment #9
anniegreens CreditAttribution: anniegreens commentedHi twigley,
I'm placing my breadcrumbs as a block with the context module to get it to show up exactly where and when I want. I'm also using the Delta blocks version of breadcrumbs as a block. None of that should really matter. You can accomplish the same thing by creating a breadcrumb block in your own custom module.
The key here is that drupal_get_breadcrumb will run before path_breadcrumbs' hook_page_alter where the magic happens. Since path_breadcrumbs is using the actual page path to set the breadcrumb, the path of the page must be known before altering the breadcrumbs. So in order for us to capture the altered breadcrumbs, we need to grab the breadcrumbs after the fact. Enter the hook_preprocess_block function, which will run after the hook_page_alter.
I've placed the above code in my theme preprocess-block.inc file (Omega sub-theme) but you may need to place it in your theme template.php file. Replace the first HOOK in hook_preprocess_block with the name of your theme. Replace the second HOOK in the IF statement with the name of the module that implements your block -- in my case 'delta_blocks'. Finally, replace the 'breadcrumbs_block' with the delta (or machine name) of the block you are overriding -- in my case it was simply 'breadcrumb'. You can get the name of the delta of the block by hovering over the 'configure' link for the block on the blocks UI admin page. Where /admin/structure/block/manage/[module_name]/[block_delta_name]/configure is the path, [module_name] is the name of the module providing the block and [delta_block_name] is the delta of the block. You can also use the devel module to output the $vars inside your preprocess function and get the same information.
Hope that helps.
Comment #10
twigley CreditAttribution: twigley commentedHi anniegreens,
Thanks for the update and the detailed description.
Unfortunately I'm still struggling with this.
Here's my current situation. I'm using Omega theme and have created my own sub-theme called clomega.
I have path breadcrumbs setup and working on a number of different types of pages. These are working fine and showing in the default position at the top of the content section, beneath the header.
I also have the delta blocks module installed and am using this to display breadcrumbs within a block called breadcrumb (default I think), which I have placed in the area I want to actually show the path breadcrumbs.
I've made the amendments to the code block you provided as above, with clomega instead of HOOK in the function name, the module as delta_blocks and using the breadcrumbs block as 'breadcrumb'.
I've added this code to a file called preprocess-block.inc and put this into the clomega/preprocess folder. When I do this and refresh the page, the code from above is actually displayed over the header of the website and doesn't appear to be being processed.
When I add this code to the template.php file and upload this nothing changes.
Any idea where I'm going wrong?
Really appreciate your ongoing help.
Comment #11
anniegreens CreditAttribution: anniegreens commentedtwigley,
Two things:
clomega_alpha_preprocess_block
.Hopefully these two items do the trick!
Comment #12
Begun CreditAttribution: Begun commented@twigley
There are some other possible issues with your code:
<?php
code block. The absence of this could be why the code is printing to screen.['#block']->delta
is not a valid variable name. Try changing it to$vars['block']->delta
or$vars['#elements']['block']->delta
. Both seem to point to the same object so I assume they are both valid variable references.This is what my preprocess-block.inc file looks like:
Comment #13
anniegreens CreditAttribution: anniegreens commentedGood catch Begun.
Yes, twigley, you are missing the
$vars['elements']
part of the second check in your if statement. It should be$vars['elements']['#block']->delta == 'breadcrumb'
Comment #14
samwillc CreditAttribution: samwillc commentedHi,
I'm having a similar problem in that the delimiter does not show up. I also use delta and context to place the breadcrumb block on the page.
I have tried the above code in template.php and in preprocess-block.inc file which I created and put in the preprocess folder in my subtheme. It still doesn't seem to work. This is the code from default/themes/custom_theme/preprocess/preprocess-block.inc:
Not sure if I'm doing something wrong here but the custom breadcrumbs module worked perfectly for me before, will have to go back to that in the meantime.
Any help is very much appreciated, thanks.
Comment #15
samwillc CreditAttribution: samwillc commentedSorry, me again. Works perfectly, WITH delimiter, and replaces the default breadcrumb block sitewide. Here's the code:
$vars['#elements']['block'] did not work for me. I didn't have to put this in template.php either. Just chucked the 'preprocess-block.inc' file in my preprocess folder and flushed caches.
Thanks people :)