Advanced Module CRUD

edited May 2013 in Bug Reports
I'm playing around with FuelCMS, I created a simple module and the crud page was automatically generated. But how do i do this with an Advanced Module?

Comments

  • edited 4:40PM
    Think of Advanced modules as another "application" folder. You can add your own models folder and module configuration file. More can be found here:
    http://www.getfuelcms.com/user_guide/modules/advanced

    Additionally, the 1.0 beta has command line generation tools to get you started with creating advanced modules and simple modules:
    https://github.com/daylightstudio/FUEL-CMS/tree/1.0
    https://github.com/daylightstudio/FUEL-CMS-User-Guide-Module
  • edited 4:40PM
    Yeah i've read all that. I mean, when you add a simple module, it automatically creates the CRUD pages, Am i able to do this with an Advanced Module? I read somewhere you could, you just had to point the config to the model, but that doesn't work.
  • edited 4:40PM
    The CRUD functions of an advanced module would essentially be the CRUD functions of any of its sub modules. The blog advanced module is a good example of this. Not that it has a fuel/modules/blog/config/blog_fuel_modules.php file that contains the "sub" module configuration.
    https://github.com/daylightstudio/FUEL-CMS-Blog-Module
  • edited 4:40PM
    Hmm, i ran the generate tools (php index.php fuel/generate/advanced example) and then ran the model generate tool (php index.php fuel/generate/simple example example)

    The model is a simple model which should generate the crud page, but it doesn't, it uses the controller which i can't remove. So i'm not sure if there's a line i must put in the config or controller to use the model CRUD.

    I'm using yesterdays clone from git.
  • edited 4:40PM
    If you have an advanced module with the same name as a simple module, they'll compete for the same fuel/example URI and the advanced module wins because it has the controller. If you are just wanting to do CRUD functions on the example model, you don't need the Example_module controller. Also, you may need to change the fuel/modules/examples/config/examples_routes.php to something like:
    $route[FUEL_ROUTE.'example/'.$c] = FUEL_FOLDER.'/module'; The module controller handles the CRUD functions on a simple module.
  • edited May 2013
    Okay. That didn't work, it just uses the default _admin view that's generated.

    I'm not using a simple and advanced module. I'm saying that the model used for a simple is in the module's models folder, but it doesn't make a CRUD page like a simple one.

    When i goto fuel/example it goes to the view file, but it needs to reroute to the CRUD page.
  • edited 4:40PM
    Just so I'm clear, these are the steps that I did to get to the simple CRUD functions:

    1. Used the command line to create the advanced module:
    php index.php fuel/generate/advanced example
    2. Used the command line to create the simple module in the example advanced module:
    php index.php fuel/generate/simple example example
    3. Removed the fuel/modules/example/controllers/example_module.php (or renamed it).
  • edited 4:40PM
    Okay, i did exactly that.

    When i generated the advanced module i got an error.
    * Could not create file libraries/Fuel_{module}.php
    I copied the template for the library and added it.

    And after i removed the controller i got this message
    Fatal error: Call to a member function name() on a non-object in /var/www/fuelcms/fuel/modules/fuel/controllers/module.php on line 47
  • edited 4:40PM
    Why don't I send you a zip of what I generated and then you can test it out on your end and we can better see what the issue is hopefully. Is the email in your profile where I should send it?
  • edited 4:40PM
    Yeah go for it
  • edited 4:40PM
    Okay, i got it all sorted. It wasn't the generation or anything like that. I had the 'Modules Allowed' option enabled, and the example module was disallowed. Totally forgot about it, my bad.

    On another note. I can't use the CRUD if a controller is there, how do i make the controller use CRUD?
  • edited 4:40PM
    The CRUD functions work when you route them to the fuel/modules/fuel/controllers/module.php controller. That module gets generated just in case you don't want to use the CRUD functions for you module at that specific URI path. A lot of the "tools" modules are like that (e.g. Backup, Validate, Tester):
    https://github.com/daylightstudio?tab=repositories
Sign In or Register to comment.