Problem/Motivation

While Features will detect conflicts between one feature and another based on shared component names - e.g., two features defining a content type with the same name - it doesn't warn about conflicts with existing components on a site.

An example of this problem is #1058902: Error when enabling Debut Article. The Debut Article feature includes a "field_image" of type media attached to an "article" content type. If a user enables this on a site installed with the Standard Drupal install profile, the site will already have a field_image that is of type image, triggering an error: FieldException: Cannot change an existing field's type. in field_update_field().

While individual feature modules could include tests relative to their own components, it would be valuable if Features itself could cover at least the most common cases.

Proposed resolution

What is a potential conflict? Is it enough that there is one or more existing features of the same component type and name? Probably not. For example, if a user has enabled a feature module, creating a content type and associated fields, disabled the feature, and then reenabled the feature, at the point of reenabling the site will already have the content type and fields, but this isn't a problem and shouldn't prevent reenabling.

So probably there is a need for testing per component type. Each component type should optionally provide a test for conflicts with existing site components.

media_gallery_requirements() in media_gallery.install contains relevant code, returning a requirements error if there is an existing field of a type different from the one being created.

Remaining tasks

Confirm approach and write patch.

User interface changes

Options:

  • Mark features as being in conflict with exiting site components?
  • Simply respond at enable time with a requirements error?

API changes

Likely would require a new features component hook.

Comments

Anonymous’s picture

Sub.

mpotter’s picture

Status: Active » Closed (won't fix)

Closing this for lack of activity.