Recipe and config-sync installs
Why config is not applied automatically
Installing ai_context through a recipe or a config sync does not create
the module's own config entities unless the recipe or sync explicitly supplies
them. This is correct, intended Drupal behavior: config:installer runs in
"syncing" mode for both paths, so hook_install() skips its workflow setup and
config/install/ is not applied on its own.
A recipe like this:
name: 'Install AI Context'
type: 'Site'
install:
- ai_context
produces a site where ai_context_item is not a moderated entity type: no
ai_context_editorial workflow, no moderation_state field, no error, no log
entry. The tags vocabulary, usage view, and default form and view displays are
also missing. You will only find out when the moderation UI is not there.
The Status report (/admin/reports/status) shows a warning when
ai_context_item is not attached to any content moderation workflow.
Config entities supplied by the module
The following config entities live in config/install/ and must all be
imported by a recipe or config sync. Leaving any of them out will make the
admin UI look incomplete or broken.
| Config entity | What it provides |
|---|---|
workflows.workflow.ai_context_editorial |
Editorial workflow (draft → published → archived); attaches moderation_state to context items |
taxonomy.vocabulary.ai_context_tags |
Tags vocabulary used by the Tags scope and the item tags field |
views.view.ai_context_usage |
Usage tracking view at /admin/config/ai/context/usage |
core.entity_form_display.ai_context_item.ai_context_item.default |
Default edit form with all fields laid out |
core.entity_view_display.ai_context_item.ai_context_item.default |
Default view display |
core.entity_view_display.ai_context_item.ai_context_item.full |
Full view display for canonical pages |
core.entity_view_mode.ai_context_item.full |
Full view mode definition |
See Content moderation for what the editorial workflow does once it is imported.
Working example recipe
name: 'My Site with AI Context'
type: 'Site'
install:
- ai_context
config:
import:
ai_context:
- workflows.workflow.ai_context_editorial
- taxonomy.vocabulary.ai_context_tags
- views.view.ai_context_usage
- core.entity_form_display.ai_context_item.ai_context_item.default
- core.entity_view_display.ai_context_item.ai_context_item.default
- core.entity_view_display.ai_context_item.ai_context_item.full
- core.entity_view_mode.ai_context_item.full
Apply the recipe with:
drush recipe path/to/my_recipe
drush cr
Config sync installs
A config sync (drush config:import) also skips hook_install(). If your
exported config directory already contains the entities listed above, they
will be imported on the next sync. If it does not, export them from a
correctly configured site first:
drush config:export
Then commit the exported YAML files and deploy with:
drush config:import
drush cr