src/Sulu/Bundle/PageBundle/Serializer/Subscriber/StructureSubscriber.php
private function addBreadcrumb(StructureBehavior $document, VisitorInterface $visitor)
    {
        $items = [];
        $parentDocument = $this->inspector->getParent($document);
        while ($parentDocument instanceof StructureBehavior) {
            $item = [];
            if ($parentDocument instanceof UuidBehavior) {
                $item['uuid'] = $parentDocument->getUuid();
            }

            $item['title'] = $parentDocument->getStructure()->getProperty('title')->getValue();

            $items[] = $item;

            $parentDocument = $this->inspector->getParent($parentDocument);
        }

        $items = array_reverse($items);

        array_walk(
            $items,
            function(&$item, $index) {
                $item['depth'] = $index;
            }
        );

        $visitor->addData('breadcrumb', $items);
    }
private function addBreadcrumb(StructureBehavior $document, VisitorInterface $visitor)
    {
        $items = [];
        $parentDocument = $this->inspector->getParent($document);
        while ($parentDocument instanceof StructureBehavior) {
            $item = [];
            if ($parentDocument instanceof UuidBehavior) {
                $item['uuid'] = $parentDocument->getUuid();
            }

            $item['title'] = $parentDocument->getStructure()->getProperty('title')->getValue();

            $items[] = $item;

            $parentDocument = $this->inspector->getParent($parentDocument);
        }

        $items = array_reverse($items);

        array_walk(
            $items,
            function(&$item, $index) {
                $item['depth'] = $index;
            }
        );

        $visitor->addData('breadcrumb', $items);
    }
private function addBreadcrumb ( StructureBehavior $ document , VisitorInterface $ visitor ) { $ items = [ ] ; $ parentDocument = $ this -> inspector -> getParent ( $ document ) ; while ( $ parentDocument instanceof StructureBehavior ) { $ item = [ ] ; if ( $ parentDocument instanceof UuidBehavior ) { $ item [ 'uuid' ] = $ parentDocument -> getUuid ( ) ; } $ item [ 'title' ] = $ parentDocument -> getStructure ( ) -> getProperty ( 'title' ) -> getValue ( ) ; $ items [ ] = $ item ; $ parentDocument = $ this -> inspector -> getParent ( $ parentDocument ) ; } $ items = array_reverse ( $ items ) ; array_walk ( $ items , function ( & $ item , $ index ) { $ item [ 'depth' ] = $ index ; } ) ; $ visitor -> addData ( 'breadcrumb' , $ items ) ; }
Adds the breadcrumb to the serialization.

@param StructureBehavior $document
@param VisitorInterface $visitor
Adds the breadcrumb to the serialization .