Collections functions
Encryption functions
General functions
Render functions
Theme permission functions
Video 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 2320 to 2371

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");

            if(
$i)
                {
                echo 
LINK_CHEVRON_RIGHT;
                }
                
            if (
$anchor)
                { 
?><a href=" echo htmlspecialchars($links[$i]['href']); ?>" 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 3rd December 2020 13:35 Europe/London time based on the source file dated 13th November 2020 15:00 Europe/London time.