Jarves\Configuration\Bundle::getContentTypesArray PHP Method

getContentTypesArray() public method

public getContentTypesArray ( ) : ContentType[]
return ContentType[]
    public function getContentTypesArray()
    {
        if ($this->contentTypes) {
            $result = [];
            foreach ($this->contentTypes as $contentType) {
                $result[$contentType->getId()] = $contentType->toArray();
            }
            return $result;
        }
    }

Usage Example

コード例 #1
0
ファイル: BundleConfigTest.php プロジェクト: jarves/jarves
    public function testContentTypes()
    {
        $xml = '
<bundle>
    <content-types>
      <content-type id="text" service="jarves.content.types.text">
        <label>Text</label>
      </content-type>
    </content-types>
</bundle>
        ';
        $bundleConfig = new Bundle('MyBundle');
        $bundleConfig->initialize($xml);
        $this->assertEquals(1, count($bundleConfig->getContentTypesArray()));
        $this->assertEquals('jarves.content.types.text', $bundleConfig->getContentTypes()[0]->getService());
        $this->assertEquals('text', $bundleConfig->getContentTypes()[0]->getId());
    }