getType(); /** * Print in function of the depth */ switch ($type) { case self::NAVIGATION_TYPE: /** * https://www.w3.org/TR/wai-aria-practices/examples/breadcrumb/index.html * Arial-label Provides a label that describes the type of navigation provided in the nav element. */ $tagAttributes->addOutputAttributeValue("aria-label", "Hierarchical breadcrumb"); $htmlOutput = $tagAttributes->toHtmlEnterTag("nav"); $htmlOutput .= '
'; $htmlOutput .= ''; return $htmlOutput; case self::TYPOGRAPHY_TYPE: try { $requiredDepth = DataType::toInteger($tagAttributes->getValueAndRemoveIfPresent(self::DEPTH_ATTRIBUTE)); } catch (ExceptionBadArgument $e) { LogUtility::error("We were unable to determine the depth attribute. The depth was set to 1. Error: {$e->getMessage()}"); $requiredDepth = 1; } if ($requiredDepth > 1) { SnippetSystem::getFromContext()->attachCssInternalStyleSheet("breadcrumb-$type"); } $htmlOutput = $tagAttributes->toHtmlEnterTag("span"); $lisHtmlOutput = ""; $actualDepth = 0; while (true) { try { $actualPath = $actualPath->getParent(); } catch (ExceptionNotFound $e) { break; } $actualDepth = $actualDepth + 1; $nameOrDefault = $actualPath->getNameOrDefault(); $liHtmlOutput = " "; $lisHtmlOutput = $liHtmlOutput . $lisHtmlOutput; if ($actualDepth >= $requiredDepth) { break; } } $htmlOutput .= $lisHtmlOutput; $htmlOutput .= ''; return $htmlOutput; default: // internal error LogUtility::error("The breadcrumb type ($type) is unknown"); return ""; } } /** * @param MarkupPath $page * @param bool $current * @param bool $link * @return string - the list item for the page */ public static function getLiHtmlOutput(MarkupPath $page, bool $current = false, bool $link = true): string { $liClass = ""; $liArial = ""; if ($current) { $liClass = " active"; /** * https://www.w3.org/WAI/ARIA/apg/patterns/breadcrumb/ * Applied to a link in the breadcrumb set to indicate that it represents the current page. */ $liArial = " aria-current=\"page\""; } $liHtmlOutput = "