HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

Vanilla Module

Hi, Can i make a specific module performing all crud operation and use this module inside any view?

Comments

  • Options
    R_JR_J Ex-Fanboy Munich Admin

    Yes.

    Take a look at those modules for some inspirations

    • /applications/dashboard/modules/class.tablesummarymodule.php
    • /applications/dashboard/modules/class.mediaitemmodule.php
    • /applications/dashboard/modules/class.sortablemodule.php
    • /applications/dashboard/modules/class.configurationmodule.php

    The ConfigurationModule is where I would start, since it basically has everything you need. It makes use of the class Form->simple() method, which renders a nice interface. You would "only" have to make the data target more flexible.
    Look at /applications/dashboard/views/settings/branding.php for an example for ConfigurationModule.

    The only problem that I see is that a module normally has one view and CRUD needs at least two: one view for the "Read" in CRUD and you can use the Create view for the Update, too. Delete wouldn't need a view. Just give the delete button the class Button Danger PopConfirm and see the magic :wink:

    You can certainly "solve" that problem by using one file for both views or using JavaScript to mingle them.


    That would make a very handy module and it would be great if you daffodils could release that to open source if you create something like that!

  • Options

    Thanks @R_J

Sign In or Register to comment.