block - PeterNaydenov/code-assembly-line GitHub Wiki
Describes process of the creation of block from current data. According aditional params the block can be saved or converted to new data object. Saved blocks can be used later as data for other template or retrived from template engine.
{
do : 'block'
, name ?: 'blockname'
, space ?: spaceSymbol
, method ?: saveMethod
}
- blockname: string. Used when we want to save block for use from other process
- spaceSymbol: string. Represent space between rendered elements. ', ' will separate elements with coma, '\n' will separate with new line, etc. Default spaceSymbol is empty space.
-
saveMethod: 'add' | 'update' | 'overwrite' | 'heap'. How to save the result. Possible values:
- add(default): Add only a non-existing values. Do not change fields that already exist;
- update: Overwrite only existing fields. Do not add new records;
- overwrite : Overwrite existing record;
- heap : Combine the old and the new value;
{ do: 'block', name: 'profile' }
Existing current-data will be converted to string block and will be saved as 'profile' block. Profile block can be retrieved tplEngine.getBlock ('profile')
. Saved blocks are available for other templates by using {{block/blockName}} placeholder.