* @inheritDoc
*/
public function appendBreadCrumb($breadcrumbs) {
- \Civi::$statics[__CLASS__]['breadcrumb'][] = $breadcrumbs;
+ if (!isset(\Civi::$statics[__CLASS__]['breadcrumb'])) {
+ \Civi::$statics[__CLASS__]['breadcrumb'] = [];
+ }
+ \Civi::$statics[__CLASS__]['breadcrumb'] += $breadcrumbs;
+ CRM_Core_Smarty::singleton()->assign('breadcrumb', \Civi::$statics[__CLASS__]['breadcrumb']);
}
/**
*/
public function resetBreadCrumb() {
\Civi::$statics[__CLASS__]['breadcrumb'] = [];
+ CRM_Core_Smarty::singleton()->assign('breadcrumb', NULL);
}
/**
*/
public function addHTMLHead($header) {
$template = CRM_Core_Smarty::singleton();
+ // Smarty's append function does not check for the existence of the var before appending to it.
+ // So this prevents a stupid notice error:
+ $template->ensureVariablesAreAssigned(['pageHTMLHead']);
$template->append('pageHTMLHead', $header);
return;
}
echo implode('', $smarty->_tpl_vars['pageHTMLHead']);
}
- // Show the breadcrumb
- if (!empty(\Civi::$statics[__CLASS__]['breadcrumb'])) {
- print '<nav aria-label="' . htmlspecialchars(ts('Breadcrumb')) . '" class="breadcrumb"><ol>';
- print '<li><a href="' . CRM_Utils_System::url('civicrm/dashboard', 'reset=1') . '">' . htmlspecialchars(ts('Home')) . '</a></li>';
- foreach (\Civi::$statics[__CLASS__]['breadcrumb'] as $breadcrumb) {
- foreach ($breadcrumb as $item) {
- print '<li><a href="' . $item['url'] . '">' . htmlspecialchars($item['title']) . '</a></li>';
- }
- }
- print '</ol></nav>';
- }
-
// @todo Add variables from the body tag? (for Shoreditch)
print $content;
return NULL;
<title>{$docTitle}</title>
</head>
<body>
-
{if $config->debug}
{include file="CRM/common/debug.tpl"}
{/if}
<div id="crm-container" class="crm-container" lang="{$config->lcMessages|substr:0:2}" xml:lang="{$config->lcMessages|substr:0:2}">
{if $breadcrumb}
- <div class="breadcrumb">
+ <nav aria-label="{ts}Breadcrumb{/ts}" class="breadcrumb"><ol>
+ <li><a href="/civicrm/dashboard?reset=1" >{ts}Home{/ts}</a></li>
{foreach from=$breadcrumb item=crumb key=key}
- {if $key != 0}
- »
- {/if}
- <a href="{$crumb.url}">{$crumb.title}</a>
+ <li><a href="{$crumb.url}">{$crumb.title}</a></li>
{/foreach}
- </div>
+ </ol></nav>
{/if}
{if $pageTitle}