Override core block templates from a package directory

Permalink
Is it possible to override the core block templates for the Autonav from a package directory?

I have created a custom view.php file and put it in this directory "/packages/<pkg_name>/blocks/autonav/templates/reponsive_header_navigation/" but it is not overriding the custom template.

All caching is turn off and I have also cleared the cache and it just won't override.

Is this meant to be like this by design?

 
ramonleenders replied on at Permalink Reply
ramonleenders
You can't in a package, that's where the /application directory is for.

What you can do though is for every new block you add, set a block template from your theme. So set a default template for all newly added blocks that's a template from your theme.

See the docs here:

https://documentation.concrete5.org/developers/working-with-blocks/w...
chillax86 replied on at Permalink Reply
Thank you for your quick reply, I see... so I cannot override core block templates from within a package but I can set a default template for new blocks.

Can I force a block template for a certain block contained within a certain area? For example I would like to force a custom 'bootstrap navbar' template for an Autonav block contained within a global area called 'header navigation'.

Is that possible? Or should I be going about things in another way?
MrKDilkington replied on at Permalink Reply
MrKDilkington
Hi wcldev,

You can force a block template to be used in a specific area using setCustomTemplate().
http://c5docs.danielrharris.com/develop/Concrete/Core/Area/Area.htm...
http://stackoverflow.com/a/15736203...
chillax86 replied on at Permalink Reply
Hi thank you for pointing this out to me, it does indeed force the template but as soon as you click on 'design and custom template' it reverts to the default template until the page is refreshed and the forced template is not selected. Is this the expected behaviour? I would of thought the expected behaviour of the forced block template would be that it is selected in 'design & custom template' and stay in place until after another template was selected and the save button was clicked. Is this a bug or by design?
MrKDilkington replied on at Permalink Reply
MrKDilkington
@wcldev

I agree that it would be helpful if the set custom template was selected in the Custom Template select drop-down.

Have you checked the bug tracker to see if others are experiencing this issue? If no one has reported this issue, I recommend reporting it and including the specific steps required to repeat the error.

concrete5 bug tracker
https://www.concrete5.org/developers/bugs...