Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Commit a282a9e

Browse files
danepowellgrasmash
authored andcommitted
Document how to handle config and content conflicts. (#305)
1 parent fb9b57a commit a282a9e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

readme/features-workflow.md

+13
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,19 @@ Features lets you define custom "bundles" that essentially let you train Feature
2525

2626
Bundles can also do a lot more to make your life easier. For instance, Features automatically suggests features based around content types and taxonomies. If you'd also like to automatically create features for, say, custom block types, you can configure that preference in your custom bundle. You can also choose to always exclude certain types of configuration (such as permissions--see below), or always group certain types of configuration (such as field storage) into a "core" bundle, which is super helpful for breaking circular dependencies (see below).
2727

28+
### Config vs content
29+
Drupal’s core config system (and by extension, the Features ecosystem) cannot be used to manage entities that Drupal considers to be content, such as nodes, taxonomy terms, and files. This can create conflicts when a configuration entity depends on a content entity, such as:
30+
31+
* You have a block type that includes a file upload field, and you want to place the block in a theme and export the block as a feature.
32+
* You have a view that is filtered by a static taxonomy term, and you want to export that view as a feature.
33+
34+
In these cases, the exported configuration file for the block or view will contain a defined dependency on a content object (referenced by UUID). If that content doesn’t exist when the feature is installed, the installation will fail.
35+
36+
The solution is to make sure that the referenced content exists before the feature is installed. There are currently two recommended methods for this:
37+
38+
* Use the default_content module to export the referenced content as JSON files, and store these files with your feature or in a dependency.
39+
* Use Migrate and a custom module to create default content from any number of custom sources, such as JSON files stored with your feature.
40+
2841
### Testing features
2942
It’s important to ensure via automated testing that features can be installed on a new site as well as enabled on existing sites.
3043

0 commit comments

Comments
 (0)