public static function getNavigationalBreadcrumbs($parentId, $crumbs = [])
    {
        $menuItems = self::getMenuItems('id');

        if (in_array($parentId, $menuItems)) {
            array_unshift($crumbs, [
                'link' => $menuItems[$parentId]->url,
                'text' => $menuItems[$parentId]->title,
            ]);

            if (!is_null($menuItems[$parentId]->parent_id)) {
                $crumbs = Breadcrumbs::getNavigationalBreadcrumbs($menuItems[$parentId]->parent_id, $crumbs);
            }
        }

        return $crumbs;
    }
public static function getNavigationalBreadcrumbs($parentId, $crumbs = [])
    {
        $menuItems = self::getMenuItems('id');

        if (in_array($parentId, $menuItems)) {
            array_unshift($crumbs, [
                'link' => $menuItems[$parentId]->url,
                'text' => $menuItems[$parentId]->title,
            ]);

            if (!is_null($menuItems[$parentId]->parent_id)) {
                $crumbs = Breadcrumbs::getNavigationalBreadcrumbs($menuItems[$parentId]->parent_id, $crumbs);
            }
        }

        return $crumbs;
    }
public static function getNavigationalBreadcrumbs ( $ parentId , $ crumbs = [ ] ) { $ menuItems = self :: getMenuItems ( 'id' ) ; if ( in_array ( $ parentId , $ menuItems ) ) { array_unshift ( $ crumbs , [ 'link' => $ menuItems [ $ parentId ] -> url , 'text' => $ menuItems [ $ parentId ] -> title , ] ) ; if ( ! is_null ( $ menuItems [ $ parentId ] -> parent_id ) ) { $ crumbs = Breadcrumbs :: getNavigationalBreadcrumbs ( $ menuItems [ $ parentId ] -> parent_id , $ crumbs ) ; } } return $ crumbs ; }
Recursively build crumbs from menu items

@param $parentId
@param array $crumbs
@return array
Recursively build crumbs from menu items