Skip to content
This repository has been archived by the owner on Aug 8, 2018. It is now read-only.

Backends customization workflow

Kate edited this page Jun 10, 2018 · 8 revisions

How to add new custom module

  • Custom Drupal modules can be added under backend-donations and backend-gifts services.
  • Custom Drupal modules must be added under web/modules/custom/ directory of backend services.

Instructions

Generate custom Druapl module for backend-donations service using Drupal concole

  1. Go to project's root directory.
  2. Run docker-compose exec be_donations ./vendor/bin/drupal generate:module --module-path="modules/custom" and follow the interactive prompt.

Generate custom Druapl module for backend-gifts service using Drupal concole

  1. Go to project's root directory.
  2. Run docker-compose exec be_gifts ./vendor/bin/drupal generate:module --module-path="modules/custom" and follow the interactive prompt.

Drupal console documentation can be checked here

How to add new contrib module

NOTE: This not yet tested, if it works we will document exact steps how to use it:

Composer Merge Plugin might solve managing contributed module dependencies in child repos by adding something like composer.local.json or any custom name. So developers in child repo won't conflict with Falcon's composer.json file.

How to alter existing Falcon backend logic

Falcon related modules reside in modules/falcon directory and developer must never edit and customize code in it. All Falcon related modules provide (should be providing) standard Drupal API ways of overriding existing functionality, logic or features.

Instructions

  1. Find the piece of code you would like to alter under modules/falcon directory.
  2. Identify how it is implemented and find relevant ways to override/alter the implementation.
  3. Create new or edit existing custom Drupal module under modules/custom directory to override and implement your custom implementation of existing Falcon code.

Also there are many ways to override existing Drupal module implementations, here is short list of common APIs used to override different parts of the system:

How to work with Drupal configs

All Falcon based projects might have different configurations and in order to manage those configurations and prevent conflicting with Falcon's default configuration all developers should use config_split module. Config split module gives us ability to define custom/project specific configurations and export/import them safely.

How to use config_split

Important NOTE: in order to manage core.extension config properly please see next section as it is different process.

When project specific configuration modification or customization is needed developers must:

  1. Make those changes in a regular way.
  2. Go to config_split configuration page /admin/config/development/configuration/config-split and edit Customizations split settings.
  3. Grey-list: choose your project specific custom config keys under CONDITIONAL SPLIT section and save.
  4. Export config using Drush docker-compose exec {container_name} drush config-export --root=/var/www/html/web.

This way you custom changes will be exported under config/customizations folder and Falcon's defauld config/sync folder will be untouched.

How to manage core.extension config

As core.extension config is used to track which modules are enabled, we need to make sure we won't conflict Falcon's default core.extension config.

  1. Grey-list: choose core.extension key under CONDITIONAL SPLIT section and save - This will Split core.extension config and when you enable or disable modules their state will be exported only in config/customizations/core.extension.yml file.
  2. Black-list: after enabling a module go to Customizations config split settings, choose all newly created config keys key under COMPLETE SPLIT section and save.
  3. Export config using Drush docker-compose exec {container_name} drush config-export --root=/var/www/html/web.

This way as those configs that were created by enabling new modules will be moved to config/customizations directory and won't conflict with Falcon's default config/sync directory.