Collections functions
General functions
Render functions
Theme permission functions
User functions
Resource functions

renderBreadcrumbs()

Description

Renders a full breadcrumbs trail.

Parameters

ColumnTypeDefaultDescription
$links array List of link "objects" that create the trail
$pre_links string '' Pre-rendered links in HTML form
$class string '' Extra classes for the main container div

Return

void

Location

include/render_functions.php lines 2688 to 2750

Definition

 
function renderBreadcrumbs(array $links$pre_links ''$class '')
    {
    global 
$lang;
    
/*
    NOTE: implemented as seen on themes and search. There is a lot of room for improvement UI wise

    TODO: search_title_processing.php is using it intensively and at the moment there are differences in terms of 
    rendered HTML between themes/ search and search_title_processing.php. We should refactor all places were breadcrumbs
    are being created and make sure they all use this function (or any future related functions - like generateBreadcrumb() ).
    */

    
if(=== count($links))
        {
        return;
        }
    
?>
    <div class="BreadcrumbsBox  echo $class?>">
        <div class="SearchBreadcrumbs">
        
        
if('' !== $pre_links && $pre_links !== strip_tags($pre_links))
            {
            echo 
$pre_links '&nbsp;' LINK_CHEVRON_RIGHT;
            }

        for(
$i 0$i count($links); $i++)
            {
            
$anchor = isset($links[$i]['href']);
            
$anchor_attrs = (isset($links[$i]["attrs"]) && is_array($links[$i]["attrs"]) && !empty($links[$i]["attrs"]) ? $links[$i]["attrs"] : array());
            
$anchor_attrs join(" "$anchor_attrs);

            
// search_title_processing.php is building spans with different class names. We need to allow HTML in link titles.
            
$title get_inner_html_from_tag(strip_tags_and_attributes($links[$i]['title']), "p");

            
// remove leading * used for featured collection sorting.
            
$title strip_prefix_chars($title,"*");

            if(
$i)
                {
                echo 
LINK_CHEVRON_RIGHT;
                }
                
            if (
$anchor)
                { 
?><a href=" echo escape_quoted_data($links[$i]['href']); ?>"
                
                 if (isset($links[$i]["menu"]) && $links[$i]["menu"]) { ?>
                    onclick="ModalClose();return ModalLoad(this, true, true, 'right');"
                 } else { ?>
                    onclick="return CentralSpaceLoad(this, true);"
                 ?>
                
                 echo $anchor_attrs?>> ?><span> echo $title?></span> if ($anchor) { ?></a> }
            if (isset(
$links[$i]['help']))
                {
                
render_help_link($links[$i]['help']);
                }
            }
            
?>
        </div>
    </div>
    

    
return;
    }

This article was last updated 29th November 2023 08:35 Europe/London time based on the source file dated 21st November 2023 09:30 Europe/London time.