Migrating from a simple module to advanced

edited April 2015 in Modules
Hi there,

Is it possible to migrate from a simple module?

* http://docs.getfuelcms.com/modules/simple

To advanced?

* http://docs.getfuelcms.com/modules/advanced

It does certainly seem possible, but I seem to be overlooking issues and bumping into issues.

Is there a best practice to achieving this?

Thanks.

Comments

  • edited 7:48AM
    Advanced modules can contain simple modules (the Blog module does this as an example):
    https://github.com/daylightstudio/FUEL-CMS-Blog-Module

    Using the blog as an example which has a blog_posts_model, if you wanted to load that in a controller or library, you would need to use one of the following syntaxes:
    // in controller (preferred method) $this->load->module_model('blog', 'blog_posts_model'); $this->load->model('blog/blog_posts_model');
  • edited 7:48AM
    Hi David,

    That certainly did help.

    I also had to comment out the module from MY_Fuel_Modules.php as it always seems to point to the new advanced module.

    On that note, the default _admin/.php seems to just say:
    "This view is located in the fuel/modules/offers/views/_admin/ folder"

    It may be helpful if it offered the same basics as the simple module, such as a data table and a way to edit or create entries right out of the box.

    I'm keen not to reinvent the wheel where possible to keep maintenance as simple as possible. What's the best practice to get these basics in the admin?

    Thanks.
  • edited 7:48AM
    The idea of an Advanced Module is that it can contain it's own simple modules, or it can be something completely different. Think of it as another "app" directory. All the modules listed here are Advanced Modules, some of which have simple modules (blog, search), and other that don't:
    http://www.getfuelcms.com/developers

    So the generated code for a simple module creates that initial controller in your fuel/modules/{module}/controllers folder which may not be needed if you are just doing simple module crud. Or you may need a non-admin controller (like the blog's "blog" controller). To generate a simple module under your advanced module you can pass a second parameter in the generation like so:
    >php index.php fuel/generate/{simple my_module} {my_advanced_module}
  • edited 7:48AM
    I see.

    Although I wasn't aware that I could generate a simple module within an advanced module, which is useful, that wasn't quite the approach I was planning on making.

    What I'd like to do is start with a base like the simple module, but then modify it to have different features, perhaps a button here or an checkbox there.

    I guess this can't be done out of the box and requires you to rewrite this functionality entirely.
  • edited April 2015
    I found that I was able to extend the /controllers/module.php to achieve this.
Sign In or Register to comment.