Scenarios

Categories

Component ID

2630398

Component name

Scenarios

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Downloads

686

Component created

Component changed

Component body

What does this module do?

This module provides an API that uses a single hook: hook_scenario_import. This hook allows any module to be used as a "scenario" (e.g. demo/example/default) with content and configuration packaged. The Scenarios API can be used to enable, disable and reset a scenario.

Scenarios use Drush commands for enablement, reset and removal.

drush enable-scenario my_module
Install and import migrations for a scenario module.

drush reset-scenario my_module
Reset a scenario rolling back content and re-importing.

drush uninstall-scenario my_module
Roll back migrations and uninstall a scenario module.

What is a Scenario?

A scenario is a module that enables configuration and content on a Drupal website. Many scenarios start out as Features that define migrations for content. Scenarios are used extensively by the Demo Framework distribution to provide a number of various Drupal demos. Scenarios can be used by anyone looking to ship their project with default content and configuration that can easily be reset or removed later on.

Scenarios UI

A basic scenario management UI can be found by visiting the route: /scenarios
To be discovered in the UI, a scenario must define a scenarios_module value in its info.yml file. For example, this default scenario from the Demo Framework uses this value for discovery.

Scenario specific themes

Scenarios can enable a theme by adding a scenarios_theme value in the info.yml file. During Scenario enablement, the theme will be turned on before the module is enabled. This allows for theme-specific configuration to be loaded prior to the Scenario configuration installation and content import migrations.