Change record status: 
Project: 
Introduced in branch: 
9.1.x
Introduced in version: 
9.1.0
Description: 

The Variable (variable) migrate source plugin has been given a new variables_no_row_if_missing configuration option. From now on, if any of the variables listed below this new variables_no_row_if_missing key are missing from the source Drupal database, the plugin will return zero rows.

The pre-existing variables configuration continues to operate as before: the variables listed under that key do not have to exist in the source Drupal database, if they are missing the plugin will return a row with an empty value for the variable.

Examples:

With this configuration, the source will return one row even when the filter_fallback_format variable isn't available:

source:
  plugin: variable
  variables:
    - filter_fallback_format

With this configuration, the source will return one row if the file_public_path variable is available, and zero if it isn't:

source:
  plugin: variable
  variables:
    - file_private_path
    - file_temporary_path
  variables_no_row_if_missing:
    - file_public_path

The variables that are guaranteed to exist (variables) and the ones that aren't (variables_no_row_if_missing) are always merged together. All of the following configurations are valid:

source:
  plugin: variable
  variables:
    - book_child_type
    - book_block_mode
    - book_allowed_types
  variables_no_row_if_missing:
    - book_child_type
    - book_block_mode
    - book_allowed_types
source:
  plugin: variable
  variables:
    - book_child_type
    - book_block_mode
  variables_no_row_if_missing:
    - book_allowed_types
source:
  plugin: variable
  variables_no_row_if_missing:
    - book_child_type
    - book_block_mode
    - book_allowed_types
Impacts: 
Module developers