getDefaultComponentName() 공개 메소드

Return the default component name.
public getDefaultComponentName ( ) : string
리턴 string
예제 #1
0
 /**
  * It should create a block property.
  *
  * @depends testCreateProperty
  */
 public function testCreateBlock($property)
 {
     $this->setUpProperty($this->block);
     $this->component->getName()->willReturn('hai');
     $this->component->getChildren()->willReturn([$property->reveal()]);
     $this->component->title = ['de' => 'Testtitel', 'en' => 'Test title'];
     $this->block->getComponents()->willReturn([$this->component->reveal()]);
     $this->block->getDefaultComponentName()->willReturn('foobar');
     /** @var BlockProperty $blockProperty */
     $blockProperty = $this->factory->createProperty($this->block->reveal());
     $this->assertInstanceOf(BlockPropertyInterface::class, $blockProperty);
     $this->assertCount(1, $blockProperty->getTypes());
     $blockType = $blockProperty->getType('hai');
     $this->assertNotNull($blockType);
     $this->assertCount(1, $blockType->getChildProperties());
     $this->assertEquals('Testtitel', $blockType->getMetadata()->get('title', 'de'));
     $this->assertEquals('Test title', $blockType->getMetadata()->get('title', 'en'));
 }
예제 #2
0
 private function createBlockProperty(BlockMetadata $property, StructureInterface $structure = null)
 {
     $blockProperty = new BlockProperty($property->getName(), ['title' => $property->title, 'info_text' => $property->description], $property->getDefaultComponentName(), $property->isRequired(), $property->isLocalized(), $property->getMaxOccurs(), $property->getMinOccurs(), $property->getParameters(), [], $property->getColspan());
     $blockProperty->setStructure($structure);
     foreach ($property->getComponents() as $component) {
         $blockPropertyType = new BlockPropertyType($component->getName(), ['title' => $component->title, 'info_text' => $component->description]);
         foreach ($component->getChildren() as $property) {
             $blockPropertyType->addChild($this->createProperty($property, $structure));
         }
         $blockProperty->addType($blockPropertyType);
     }
     return $blockProperty;
 }