blocks (Smarty only)
Note
Extending Twig blocks
The blocks section in metadata.php is used for Smarty templates only.
To find out how to extend Twig blocks, see Twig template documentation for modules.
- Description:
In this array are registered all module Smarty templates blocks. On module activation they are automatically inserted into database. On activating/deactivating module, all module blocks also are activated/deactivated.
- Type:
array of arrays. Sub keys can be
template
,block
,file
andposition
.- Mandatory:
no
Example
'blocks' => [ [ 'template' => 'widget/sidebar/partners.tpl', 'block'=>'partner_logos', 'file'=>'/views/blocks/oepaypalpartnerbox.tpl', 'position' => '2' ], [ 'template' => 'page/checkout/basket.tpl', 'block'=>'basket_btn_next_top', 'file'=>'/views/blocks/oepaypalexpresscheckout.tpl', 'position' => '1' ], [ 'template' => 'page/checkout/basket.tpl', 'block'=>'basket_btn_next_bottom', 'file'=>'/views/blocks/oepaypalexpresscheckout.tpl' ], ],
Differences in block file definition per shop/metadata version.
Template block file
value holding path to your customized block should be defined using full path from module directory, earlier it was a sub path from modules out/blocks
directory.
You can define a position of a block if a template block is extended multiple (by different modules).
So you can sort the block extensions. This is done via the optional template block position
value.
Theme-specific blocks
To register or extend theme-specific block template, add a ‘theme’ key to the block’s definition:
'blocks' => [
[
'theme' => 'shop_theme_id'
'template' => 'name_off_shop_template_which_contains_block',
'block' => 'name_off_shop_block',
'file' => 'path_to_module_block_file',
]
]