private function getCategoryBreadcrumb(\Magento\Catalog\Model\Category $category)
    {
        $path    = $category->getPath();
        $rawPath = explode('/', $path);

        // First occurence is root category (1), second is root category of store.
        $rawPath = array_slice($rawPath, 2);

        // Last occurence is the category displayed.
        array_pop($rawPath);

        $breadcrumb = [];
        foreach ($rawPath as $categoryId) {
            $breadcrumb[] = html_entity_decode($this->getCategoryNameById($categoryId, $category->getStoreId()));
        }

        return $breadcrumb;
    }
private function getCategoryBreadcrumb(\Magento\Catalog\Model\Category $category)
    {
        $path    = $category->getPath();
        $rawPath = explode('/', $path);

        // First occurence is root category (1), second is root category of store.
        $rawPath = array_slice($rawPath, 2);

        // Last occurence is the category displayed.
        array_pop($rawPath);

        $breadcrumb = [];
        foreach ($rawPath as $categoryId) {
            $breadcrumb[] = html_entity_decode($this->getCategoryNameById($categoryId, $category->getStoreId()));
        }

        return $breadcrumb;
    }
private function getCategoryBreadcrumb ( \ Magento \ Catalog \ Model \ Category $ category ) { $ path = $ category -> getPath ( ) ; $ rawPath = explode ( '/' , $ path ) ; // First occurence is root category (1), second is root category of store. $ rawPath = array_slice ( $ rawPath , 2 ) ; // Last occurence is the category displayed. array_pop ( $ rawPath ) ; $ breadcrumb = [ ] ; foreach ( $ rawPath as $ categoryId ) { $ breadcrumb [ ] = html_entity_decode ( $ this -> getCategoryNameById ( $ categoryId , $ category -> getStoreId ( ) ) ) ; } return $ breadcrumb ; }
Return a mini-breadcrumb for a category

@param \Magento\Catalog\Model\Category $category The category

@return array
Return a mini - breadcrumb for a category