Through a registry in System, not a direct reference. A module that names another cannot be installed without it, and fatals on a site where it is switched off.

The rule: an application depends on system and nothing else. Every first-party one does, and there are tests asserting it.

The reason is not tidiness. A use of another module's class compiles perfectly and fatals only on a site that has switched that module off — so it works everywhere except the one configuration you did not try.

When you need two modules to co-operate, one of these already exists:

  • content_types — say how to find your content, and search finds it.
  • widget_types / widget_areas — offer blocks, and offer places to put them.
  • discussions — attach comments to anything without owning a comments system.
  • personal_data — declare which of your tables describe a member.
  • Groups — restrict anything to groups and every viewer check already works.

🚨 Clubs is the worked example. A club contains forums, albums, calendars and blogs — and depends on none of them. It gives each club a group, restricts the containers to it, and records ownership in a join table it owns. Search, widgets and permissions then work with no club code in any of them.

Sign in to say whether this helped.