Note the upgraded forum! If you are experiencing issues logging in, you may need to reset your password which should send an email. If the email doesn't arrive, be sure to check your spam folder just in case.

Advanced Module: autoload

edited November 2015 in Modules
Hi

I've got a helper in an advanced module which I need to be generally available. I'd expect to add it to the autoload config but that doesn't work. Adding my own autoload.php to the module's config directory doesn't work either.

I've noticed constants and routes is exposed for advanced modules, is autoload exposed in the same way? I've noticed in the docs for the blog module, it suggests you load the helper manually before using it so I'm guessing the ability is not available?

It would be ideal if I can bundle my advanced module with everything included rather than having to ask users to manually copy the helper to ./application/helpers and edit their own ./application/config/autoload.php before being able to use the module in their projects.

Cheers

Comments

  • edited 8:33AM
    You can autoload advanced module helper in autoload.php by adding your helper in $autoload['helper'] = array('my_helper') and $autoload['packages'] = array(ADVANCED_MODULE_NAME_PATH);
  • edited November 2015
    Cool, thanks. That'll help with half the problem and will get me moving.

    Just need to work out how to expose autoload as an advanced module config file...

    It seems I have the same issue with libraries too. The above workaround works.

    It would be nice if custom fields could be handled solely within the advanced module too, it seems I need to edit MY_custom_fields.php and reference the class loaded by the libraries section of autoload
  • edited 8:33AM
    you have to load libraries from module as well as it does Fuel,
    $autoload['libraries'] = array('fuel/asset', 'fuel/fuel', my_module/my_lib);
Sign In or Register to comment.