Creitive\Breadcrumbs\Breadcrumbs::renderCrumbs PHP Method

renderCrumbs() protected method

Renders the crumbs one by one, and returns them concatenated.
protected renderCrumbs ( ) : string
return string
    protected function renderCrumbs()
    {
        end($this->breadcrumbs);
        $lastKey = key($this->breadcrumbs);
        $output = '';
        $hrefSegments = array();
        $position = 1;
        foreach ($this->breadcrumbs as $key => $crumb) {
            $isLast = $lastKey === $key;
            if ($crumb['hrefIsFullUrl']) {
                $hrefSegments = array();
            }
            if ($crumb['href']) {
                $hrefSegments[] = $crumb['href'];
            }
            $href = implode('/', $hrefSegments);
            if (!preg_match('#^https?://.*#', $href)) {
                $href = "/{$href}";
            }
            $output .= $this->renderCrumb($crumb['name'], $href, $isLast, $position);
            $position++;
        }
        return $output;
    }