Cascade Core  v0.12-1-g22cbbeb
 All Classes Namespaces Functions Variables Pages
Public Member Functions | Protected Attributes | List of all members
ClassBlockStorage Class Reference

Load configuration of blocks. More...

Inheritance diagram for ClassBlockStorage:
Inheritance graph

Public Member Functions

 __construct ($storage_opts, $context, $alias, $is_write_allowed)
 Constructor will get options from core.json.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.
 
 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. More...
 

Protected Attributes

 $filename_match_regexp = '/^[\/a-zA-Z0-9_]+\.php$/'
 Regular expression to match files containing block classes.
 
 $filename_to_block_regexp ='/^\/([\/a-zA-Z0-9_-]+)\.php$/'
 Regular expression to convert filename to block name.
 

Detailed Description

Load configuration of blocks.

It allows loading blocks from many different storages like simple INI files, SQL database or cloud blob storage.

This class loads native PHP classes.

Constructor & Destructor Documentation

__construct (   $storage_opts,
  $context,
  $alias,
  $is_write_allowed 
)

Constructor will get options from core.json.php file.

Arguments: $storage_opts - Options loaded from config file $context - Common default context (dependency injection container) passed to all storages, and later also to all blocks.

Todo:
Remove this

Implements IBlockStorage.

Member Function Documentation

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.

Implements IBlockStorage.

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 or false.

Implements IBlockStorage.

Here is the call graph for this function:

describeBlock (   $block)

Describe block for documentation generator.

Returns structure similar to JSON files in which composed blocks are stored. Inputs and outputs are completely different, rest is mostly the same.

Implements IBlockStorage.

loadBlock (   $block)

Load block configuration.

Returns false if block is not found.

Implements IBlockStorage.

Here is the caller graph for this function:

getKnownBlocks ( $blocks = array())

List all available blocks in this storage.

/

Todo:
Move file scanner to separate class and remove inheritance relation with JsonBlockStorage.

Implements IBlockStorage.