How do I force my theme to load module plugins  Bottom

  • Hi,

    I need to have a module plugin available in my theme. How do I tell my theme that I want to have plugins from my module loaded? Any tips are appreciated.

    Greetings/Thanks
    R
  • zikula version?
  • 1.2.3 (soon 1.2.4).

    Greetings/Thanks
    R
  • I know how to do it in 1.3, but I'm not sure its even possible in 1.2.x. maybe try putting it in MyTheme/templates/plugins/?
  • How do you do it 1.3?

    Greetings/Thanks
    R
  • In the module installer, you register a Persistent handler to make all your plugins available.

    then that callable needs to add the plugin directory to the view stack.

    It's pretty slick actually.
  • I just looked at the pnRender class and found the function _add_plugins_dir() ... I haven't tried it yet, but I'm guessing this can be used to force the loading of module plugins ...

    Greetings
    R
  • Robert,

    You should not need to do that. AFAIK themes automatically register the theme/Name/templates/plugins folder.

    Drak

    --
    Zikula Lead Developer
    Board Member of the Zikula Foundation
    Follow me on twitter.com/zikuladrak
  • OK, but that means that I need to copy my module plugin to theme/Name/templates/plugins ... I somehow don't like having multiple pieces of code floating around my code tree ... OTOH, if it works and that's the way to do it, I'll gladly take it as a solution ...

    Greetings/Thanks
    R
  • Sure, but since you are using Zikula 1.2.x, this is your only option.

    From 1.3.0 you can do as Craig says. You can register a persistent event handler (intercepting theme.init or view.init depending on what you want to do) which can then register the plugin. From 1.3.0 calling Smarty methods directly is not allowed, you must use the methods provided in the Zikula_View class.

    Regards,

    Drak

    --
    Zikula Lead Developer
    Board Member of the Zikula Foundation
    Follow me on twitter.com/zikuladrak
  • Quote

    From 1.3.0 calling Smarty methods directly is not allowed,


    You mean because they'll be marked 'private' (or protected)?

    Greetings/Thanks
    R
  • I remember a config feature available for modules,
    that I see is available for themes too on the 1.2.4 code (pnTheme.class.php):

    Use a text file indicating which module plugin paths needs to be added:
    /templates/config/usemodules.txt
    Each line should be a module name, for instance:

    Code

    News
    scribite
    If you rely on plugins of those modules.

    If it doesn't work, remove the TXT extension.
    I remember I've added it because windows doesn't allow files without extension, but it was like that for previous versions.
    Try it.

    --
    - Mateo T. -
    Mis principios... son mis fines
  • Ah yes, I remember this now - but word of warning. That is for Zikula 1.2.x or less. From Zikula 1.3.0 you should use the persistent handlers because usemodules.txt is deprecated and will not work when legacy mode is disable (and will be removed entirely from 1.4.0).

    Regards,

    Drak

    --
    Zikula Lead Developer
    Board Member of the Zikula Foundation
    Follow me on twitter.com/zikuladrak
  • 0 users

This list is based on users active over the last 60 minutes.