Matt Habermehl
Matt Habermehl

Reputation: 3

Setting custom template in page type override in a package in concrete5

In Concrete5.6.3.2 I have created a custom package wherein I override a core block type 'page_list'. In a custom page type in the same package I have defined a new area:

$a = new Area('main');

I wish to set a custom template (view) for the page_list block when added to that area in my custom page type. I've read many of the other answers on similar subjects, but I assume that the reason this is not working for me is either 1) because I'm working from within a custom package or 2) that in that package I am overriding a core concrete5 block type.

Here is what I did immediately below the line of code above:

$a->setCustomTemplate('page_list', 'templates/events.php'); // I have also tried without the .php
$a->display($c);

The events.php view is in root/packages/my_package/blocks/page_list/templates/events.php

However, try as I might, the custom template is not the default template when I add the page_type block to that area. Are my assumptions about why this is not working correct? How does one get around this?

Thanks!

Upvotes: 0

Views: 552

Answers (1)

DSG
DSG

Reputation: 436

I believe setCustomTemplate() just makes the template available for use, but does not make it the default. In 5.6 I think the only way to do this is override the block's view.php, which seems to not work from a package.

In 5.7 they have fixed this problem and you can set default block templates from the theme's PageTheme class

Upvotes: 0

Related Questions