Proper way to define module defaults.

Created on 5 March 2015, over 9 years ago
Updated 9 August 2023, 11 months ago

Problem

Currently features doesn't have a notion of module provided defaults (that may be overridden by features). This has lead to a lot of confusion in the file_entity and media issue queue.

There is a workaround to deal with that situation athough it does not work in all cases (see πŸ› Default file entities are not exportable by features (Sibling Issue) Closed: works as designed for part of the history):

Modules save their defaults to the database in hook_install(). Feature exports then work, but the features are initially overridden. Also if a module wants to override the defaults provided by another (ie. media overriding file_entity) they might override user-made changes in the database made between the two module installs.

Proposed solution

Ideally precedence would look something like this (later items override earlier items):

  1. (non-feature) module provided defaults.
  2. Features.
  3. User modifications.

Any solution that deals with this problem has to make (at least) the distinction between those 3 - otherwise it will fail in any scenario where a distinction it does not make becomes relevant.

Current status

The patch provided in #23 does two things:

  1. It makes sure the non-features implementations of a ctools api are called before their feature counterparts. Thus ensuring that features always override non-feature modules. This is done using hook_ctools_plugin_api_alter().
  2. The definition of a conflict is changed slightly: Previously a component was in conflict if there was another module defining the same data. With the patch it's only a conflict if the offending component is also declared in the module's .info file. In essence features only conflict with other features.
πŸ› Bug report
Status

Fixed

Version

2.0

Component

Ctools

Created by

πŸ‡¦πŸ‡ΉAustria torotil

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024