How to install a default block template with a package?
Permalink 1 user found helpful
I am building a theme and want to include a custom template for the search block. I know how to put alternate block templates in my package so that they will appear in the "Custom Template" menu for the search block (seehttp://www.concrete5.org/community/forums/customizing_c5/how-to-cre... ), but I'd like to make this custom template actually be the default.
I found this thread:
http://www.concrete5.org/community/forums/themes/making_a_custom_th...
which shows how to make a default block template if you're building the block for your site (not installing it via a package) -- but since I want this theme to go up on the marketplace, I'd like to have this be done when the package is installed. I have looked through the documentation, the forums, and the concrete/controllers/install.php file's configure() function, but not been able to figure out a way to achieve this. Does anyone know how this can be done (if at all)?
Thanks!
-Jordan Lev
I found this thread:
http://www.concrete5.org/community/forums/themes/making_a_custom_th...
which shows how to make a default block template if you're building the block for your site (not installing it via a package) -- but since I want this theme to go up on the marketplace, I'd like to have this be done when the package is installed. I have looked through the documentation, the forums, and the concrete/controllers/install.php file's configure() function, but not been able to figure out a way to achieve this. Does anyone know how this can be done (if at all)?
Thanks!
-Jordan Lev
im not sure, maybe doing something like normal templates but naming it view?
is this block "hard coded" into your theme? If so then you can call a desired custom template for that block when within the render function. I'm not sure if this will work with packages or not though.
It sounds like you'd like to be able to create packages/your_package/blocks/search/view.php, and then make all instances of search point to this, rather than concrete/blocks/search/view.php or blocks/search/view.php. Unfortunately we don't support this, although I can see why it might be desirable.
One way you could get around this: install the search template as a custom template, and then when installing your package, you could get a list of all block types of the search variety, and then update all the search blocks to use that custom template instead. Not perfect, of course, and some people may dislike their search's being changed without prompting, but it would probably be pretty easily doable.
One way you could get around this: install the search template as a custom template, and then when installing your package, you could get a list of all block types of the search variety, and then update all the search blocks to use that custom template instead. Not perfect, of course, and some people may dislike their search's being changed without prompting, but it would probably be pretty easily doable.
@Mnkras - I tried that but it didn't work.
@jelthure - the block is not hard-coded into the theme -- I am trying to make it "generalizable" for the marketplace -- if it were just for a project of mine this would be no problem.
@andrew - thanks for the info. This issue is actually a result of trying to solve another issue -- seehttp://www.concrete5.org/community/forums/customizing_c5/how-to-implement-generic-sidebar-boxes-in-themes-for-the-marketp/ -- in that thread, Franz suggested that in order to make sidebar blocks work in a "generic" way for the marketplace (not specific to any single site I'm building), I could provide custom templates as part of the theme package. My worry, though, is that the custom block templates are not easily discoverable (like you don't know there are any custom templates for a block unless you click on the "Custom Template" link). I suppose I can put this info in the template description on the marketplace, but it seems that the purpose of the marketplace themes is to provide an out-of-the-box experience for people unfamiliar with coding.
Oh well, I wouldn't consider this a dealbreaker -- just a UI polish kind of thing.
-Jordan Lev
@jelthure - the block is not hard-coded into the theme -- I am trying to make it "generalizable" for the marketplace -- if it were just for a project of mine this would be no problem.
@andrew - thanks for the info. This issue is actually a result of trying to solve another issue -- seehttp://www.concrete5.org/community/forums/customizing_c5/how-to-implement-generic-sidebar-boxes-in-themes-for-the-marketp/ -- in that thread, Franz suggested that in order to make sidebar blocks work in a "generic" way for the marketplace (not specific to any single site I'm building), I could provide custom templates as part of the theme package. My worry, though, is that the custom block templates are not easily discoverable (like you don't know there are any custom templates for a block unless you click on the "Custom Template" link). I suppose I can put this info in the template description on the marketplace, but it seems that the purpose of the marketplace themes is to provide an out-of-the-box experience for people unfamiliar with coding.
Oh well, I wouldn't consider this a dealbreaker -- just a UI polish kind of thing.
-Jordan Lev
Packages, for the most part, seem designed to be self-contained, and that makes sense from an application view. They are easy to install and uninstall.
Packages do not provide a way to install customized files into site directories to override functionality unless specific installation routines are written for the package controller. That's not a big deal, but that means there is no standard way to do this with a package. Something like multiple authentication methods, for example, needs to be bolted onto C5 more closely than what a package can provide.
I don't know if a package can be broadened to include this kind of "enhancement" to a site, or if this is something different from a package.
Packages do not provide a way to install customized files into site directories to override functionality unless specific installation routines are written for the package controller. That's not a big deal, but that means there is no standard way to do this with a package. Something like multiple authentication methods, for example, needs to be bolted onto C5 more closely than what a package can provide.
I don't know if a package can be broadened to include this kind of "enhancement" to a site, or if this is something different from a package.