0

I've created a breadcumb using this and I've created one. But I would like to create breadcrumb for each page. I've 3 forms, above the form I need to set the progress of the form in the form of breadcrumb,

Drupal 7

$breadcrumb[] = l('hi', '/hi');
drupal_set_breadcrumb($breadcrumb);

In drupal 8 I've tried to use

$b = new Breadcrumb();
$breadcrumb[] = Link::createFromRoute(t('Home'), '<front>');
return $b->setLinks($new_breadcrumbs);

But this is not working... how we can show that and where am I doing wrong?

0

There is a block in drupal 8 for displaying breadcrumb on your pages. First set visibility of that block on the pages you want to show breadcrumbs.

Then in template_preprocess_breadcrumb in your theme's .theme file you can change the breadcrumbs variables.

For additional functionality you can create breadcrumb.html.twig file in templates folder of your theme.

| improve this answer | |
  • Is this the best way to create a simple static breadcrumb? – Fazeela Abu Zohra Feb 19 '16 at 11:02
  • For creating static breadcrumb set your breadcrumb variable in template_preprocess_breadcrumb. – Neelam Chaudhary Feb 19 '16 at 11:07
  • I want it above a form – Fazeela Abu Zohra Feb 19 '16 at 11:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.