I have created custom template for PageList block and need it to be used to get required visual effect. User needs to have possibility to add new instances of the block to page (they are used as slides for carousel plugin) but in that case he needs to remember to change block template from default to the custom one each time when new block instance (new slide) is added.
Is there any way to force concrete5 to automatically use custom block template instead default one?
Yes, you can enforce this on a per-area basis. In your theme's page type template, find the code for the editable area you want to enforce this custom template on, and call the setCustomTemplate
function. For example:
$a = new Area('Main');
$a->setCustomTemplate('page_list', 'templates/your_custom_template');
$a->display($c);
The first argument is the blocktype handle for the block you want to apply this to, and the second argument is the custom template (note that there is not a .php
extension at the end of that -- the C5 system will add that automatically).