Sulu\Component\Content\Document\Behavior\StructureBehavior::getStructure PHP Method

getStructure() public method

Return the StructureInterface instance.
public getStructure ( ) : Sulu\Component\Content\Document\Structure\StructureInterface
return Sulu\Component\Content\Document\Structure\StructureInterface
    public function getStructure();

Usage Example

Example #1
0
 /**
  * Adds the properties of the structure to the serialization.
  *
  * @param StructureBehavior $document
  * @param VisitorInterface $visitor
  */
 private function addStructureProperties(StructureMetadata $structureMetadata, StructureBehavior $document, VisitorInterface $visitor)
 {
     /** @var ManagedStructure $structure */
     $structure = $document->getStructure();
     $data = $structure->toArray();
     foreach ($structureMetadata->getProperties() as $name => $property) {
         if ($name === 'title' || !array_key_exists($name, $data) || $property->hasTag('sulu.rlp')) {
             continue;
         }
         $visitor->addData($name, $data[$name]);
     }
 }