Load configuration of blocks. More...
Public Member Functions | |
__construct ($storage_opts, $context, $alias, $is_write_allowed) | |
Constructor will get options from core.ini.php file. More... | |
isReadOnly () | |
Returns true if there is no way that this storage can modify or create blocks. More... | |
createBlockInstance ($block) | |
Create instance of requested block and give it loaded configuration. More... | |
describeBlock ($block) | |
Describe block for documentation generator. More... | |
loadBlock ($block) | |
Load block configuration. More... | |
storeBlock ($block, $config) | |
Store block configuration. More... | |
deleteBlock ($block) | |
Delete block configuration. | |
blockMTime ($block) | |
Get time (unix timestamp) of last modification of the block. | |
getKnownBlocks (&$blocks=array()) | |
List all available blocks in this storage. | |
Load configuration of blocks.
It allows loading blocks from many different storages like simple INI files, SQL database or cloud blob storage.
__construct | ( | $storage_opts, | |
$context, | |||
$alias, | |||
$is_write_allowed | |||
) |
Constructor will get options from core.ini.php file.
$storage_opts | Options loaded from config file |
$context | Common default context (dependency injection container) passed to all storages, and later also to all blocks. |
$alias | Name of the storage (use it in error messages) |
$is_write_allowed | If false, block storage is not allowed to store or update any blocks. |
Implemented in JsonBlockStorage, and ClassBlockStorage.
isReadOnly | ( | ) |
Returns true if there is no way that this storage can modify or create blocks.
When creating or modifying block, first storage that returns true will be used.
Implemented in JsonBlockStorage, and ClassBlockStorage.
createBlockInstance | ( | $block | ) |
Create instance of requested block and give it loaded configuration.
No further initialisation here, that is job for cascade controller. Returns created instance, block configuration (array) or false.
If block configuration is returned, CascadeController will execute shebang handler to create instance of the Block using this configuration.
Implemented in JsonBlockStorage, and ClassBlockStorage.
describeBlock | ( | $block | ) |
Describe block for documentation generator.
Returns structure similar to JSON files in which composed blocks are stored.
In contrast to loadBlock() method, the describeBlock() may return significantly modified structure. Or completely artificial structure generated only for documentation purposes.
/
Implemented in JsonBlockStorage, and ClassBlockStorage.
loadBlock | ( | $block | ) |
Load block configuration.
Returns false if block is not found.
Structure returned by loadBlock() can be directly stored by storeBlock(). The block editors are expected to load a block using loadBlock(), modify the structure, and then store it back using storeBlock(). Therefore, loadBlock() and storeBlock() are complementary pair.
Implemented in JsonBlockStorage, and ClassBlockStorage.
storeBlock | ( | $block, | |
$config | |||
) |
Store block configuration.
Use loadBlock() to retrive block configuration, or create a new block.
Implemented in JsonBlockStorage, and ClassBlockStorage.