Updated Breadcrumb.php custom template! Now uses 'replace_link_with_first_in_nav'

Permalink 1 user found helpful
With Andrew's help, I brought the breadcrumb.php up to date. He provided me all the code and told me generally where to put it, but not being a PHP expert, it took me 12+ tries to get every line in the right place on the breadcrumb.php file.

The code below will give you a breadcrumb custom template that ALSO uses the 'replace_link_with_first_in_nav' functionality.

For some reason it was added to the header_menu template, but overlooked on the breadcrumb template.

Took me forever to get it working, so I offer it for anyone who may need it in the future...


<?php  
   defined('C5_EXECUTE') or die(_("Access Denied."));
   $aBlocks = $controller->generateNav();
   $nh = Loader::helper('navigation');
   $c = Page::getCurrentPage();
   $i = 0;
   foreach($aBlocks as $ni) {
      $_c = $ni->getCollectionObject();
      $pageLink = false;
      if ($_c->getCollectionAttributeValue('replace_link_with_first_in_nav')) {
         $subPage = $_c->getFirstChild();
         if ($subPage instanceof Page) {
         $pageLink = $nh->getLinkToCollection($subPage);
         }
      }

 
dstew99 replied on at Permalink Reply
dstew99
Thank you for working on this. It will be beneficial.