On this page
Constant values
This documentation needs work. See "Help improve this page" in the sidebar.
Sometimes you need a constant value. Perhaps it's for the concatenation plugin or simply some value that is always fixed. In this case, first you need to define a constant in the source and then use it as any other in your process. The following example sets the value of the id destination property to node_search:
source:
constants:
id: node_search
process:
id: constants/id
Note that the constants key is not special. If the source contains a constants property, use another name, for example defaults. In other words, the code example below is equivalent to the previous one:
source:
defaults:
id: node_search
process:
id: defaults/id
This works because the definition of the source provides the default values for every row retrieved from the source (without deep merging).
Please note that using the default_value process plugin is an alternative and simpler way to define constant values in the destination.
Contrib module migrations
While custom migrations need to specify their config dependencies explicitly, the migrate_drupal module automates part of this by treating the value of constants/entity_type as a Drupal 8 entity type and adding a dependency on the module providing said entity type. This is strictly migrate_drupal specific.
Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion
Still on Drupal 7? Security support for Drupal 7 ended on 5 January 2025. Please visit our Drupal 7 End of Life resources page to review all of your options.