Craft\SeomaticService::getDefaultBreadcrumbs PHP Method

getDefaultBreadcrumbs() public method

--------------------------------------------------------------------------------
public getDefaultBreadcrumbs ( $meta )
    public function getDefaultBreadcrumbs($meta)
    {
        $result = array();
        $element = null;
        $element = craft()->elements->getElementByUri("__home__");
        if ($element) {
            $result[$element->title] = $this->getFullyQualifiedUrl($element->url);
        } else {
            $homeName = craft()->config->get("breadcrumbsHomeName", "seomatic");
            $result[$homeName] = $this->getFullyQualifiedUrl(craft()->getSiteUrl());
        }
        /* -- Build up the segments, and look for elements that match */
        $uri = "";
        $segments = craft()->request->getSegments();
        if ($this->lastElement && $element) {
            if ($this->lastElement->uri != "__home__" && $element->uri) {
                $path = parse_url($this->lastElement->url, PHP_URL_PATH);
                $path = trim($path, "/");
                $segments = explode("/", $path);
            }
        }
        /* -- Parse through the segments looking for elements that match */
        foreach ($segments as $segment) {
            $uri .= $segment;
            $element = craft()->elements->getElementByUri($uri);
            if ($element && $element->uri) {
                $result[$element->title] = $this->getFullyQualifiedUrl($element->url);
            }
            $uri .= "/";
        }
        return $result;
    }