Jump to content

Recommended Posts

Posted

I am working on a module that will require a template and certain set of fields. I was wondering what the best practices are to achieve this. I have used soma's Images Manager module and I noticed it requires you to manually create some fields, templates, and pages.

The current route I am considering is:

  • Set the module up with ConfigurableModule and several options for the default field/template names.
  • IF: the template and field names do not already exist:
    • ​Create the templates and fields, indicate install is completed successfully
  • ​ELSE:
    • Prompt the user to create the templates/fields manually and enter the names in the module's configuration.

Alternately, I suppose the install method could take the base name for fields/templates and add an incremented number to the end until a unique name is found. This might be preferable since it would not require any manual configuration.

Thoughts?

Posted

Sounds good, both alternatives. I think it depends on what you want to do with the module to choose the one and not the other.

And according to this there pops up a question:

How will you handle the created fields and templates by uninstalling the module?

Do you want to remove all pages created through the module and the templates and the fields, or do leave it there?

Posted

I would check if any pages are still using the template and only remove it if it was zero. I might make it a config option to have the module remove its pages on uninstall, though.

  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...