eZ\Publish\Core\FieldType\Page\PageService::getBlockDefinitionByIdentifier PHP Method

getBlockDefinitionByIdentifier() public method

Returns a block definition for a given block identifier.
public getBlockDefinitionByIdentifier ( string $blockIdentifier ) : array
$blockIdentifier string
return array
    public function getBlockDefinitionByIdentifier($blockIdentifier)
    {
        if (!isset($this->blockDefinition[$blockIdentifier])) {
            throw new OutOfBoundsException("Could not find an ezpage block definition for given identifier '{$blockIdentifier}'");
        }
        return $this->blockDefinition[$blockIdentifier];
    }

Usage Example

 /**
  * @expectedException OutOfBoundsException
  *
  * @covers eZ\Publish\Core\FieldType\Page\PageService::getBlockDefinitionByIdentifier
  */
 public function testGetBlockDefinitionByIdentifierInvalidBlock()
 {
     $this->pageService->getBlockDefinitionByIdentifier('invalid_block_identifier');
 }