You are here

public function LoadMultipleDeriver::getDerivativeDefinitions in Drupal 7 to 8/9 Module Upgrader 8

Gets the definition of all derivatives of a base plugin.

Parameters

array $base_plugin_definition: The definition array of the base plugin.

Return value

array An array of full derivative definitions keyed on derivative id.

Overrides DeriverInterface::getDerivativeDefinitions

See also

getDerivativeDefinition()

File

src/Plugin/DMU/Converter/Functions/LoadMultipleDeriver.php, line 15

Class

LoadMultipleDeriver
Builds derivative definitions for the _load_multiple plugin.

Namespace

Drupal\drupalmoduleupgrader\Plugin\DMU\Converter\Functions

Code

public function getDerivativeDefinitions($base_definition) {
  $derivatives = [];
  foreach ([
    'node',
    'user',
    'comment',
    'taxonomy_term',
  ] as $entity_type) {
    $function = $entity_type . '_load_multiple';
    $variables = [
      '@function' => $function,
    ];
    $derivative = $base_definition;
    $derivative['function'] = $function;
    $derivative['entity_type'] = $entity_type;
    $derivative['message'] = $this
      ->t('`@function` is now `EntityStorageInterface::loadMultiple()`.', $variables);
    $derivative['description'] = $this
      ->t('Rewrites calls to @function().', $variables);
    $derivatives[$entity_type] = $derivative;
  }
  return $derivatives;
}