[development] Distributing "bi-modal" Drupal modules
Brian Vuyk
brian at brianvuyk.com
Tue Feb 16 19:15:05 UTC 2010
I think your first roadblock would be the .info files - the .info needs
to be called 'modulename.info', and you won't be able to enable it if
it's not syntactically correct for your version of Drupal.
However, it would be quite possible to release a module package with
both a D6 and D7 module. Then these could share include files if necessary.
That is, you could probably release a folder structure / package along
the lines of:
mymodule/
includes/shared.inc
mymodule_d6.module
mymodule_d6.info
mymodule_d7.module
mymodule_d7.info
Where 'includes/shared.inc' would include logic shared between the two
different modules. Both modules would show up on the 'Modules' page, but
only the one corresponding to the correct version of Drupal could be
enabled.
Brian Vuyk
Web Design & Development
http://www.brianvuyk.com
Rob Thorne wrote:
> There are a couple of large software projects that are designed to
> install together with Drupal (CiviCRM is one of them). Typically, a
> project like this distributes a Drupal module that handles the
> embedding of the project inside of a Drupal install.
>
> Is it even possible for a project like this to distribute either:
>
> 1. Both a Drupal 6 *and* a Drupal 7 module (i.e., will Drupal look at
> the .info files and ignore the "wrong" version), or
> 2. A single Drupal module that keeps its Drupal-version specific
> features (changed, new or dropped API calls, hooks with
> incompatible call signatures, etc.) in .inc files and loads them
> dynamically?
>
> This is not "the done thing", and the module upgrade instructions in
> the handbook show it would be pretty daunting to do for anything but a
> trivial module. But is it even possible?
>
> Rob Thorne
> Torenware Networks
More information about the development
mailing list