You are here

public function FunctionCallDeriver::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/Analyzer/FunctionCallDeriver.php, line 34

Class

FunctionCallDeriver

Namespace

Drupal\drupalmoduleupgrader\Plugin\DMU\Analyzer

Code

public function getDerivativeDefinitions($base_definition) {
  $derivatives = [];
  foreach ($this->config as $key => $info) {

    // $key can either be the name of a single function, or an arbitrary string
    // identifying a group of functions to handle.
    if (empty($info['functions'])) {
      $info['functions'] = [
        $key,
      ];
    }
    foreach ($info['functions'] as $function) {
      $variables = [
        '@function' => $function . '()',
      ];
      $derivative = array_merge($base_definition, $info);
      $derivative['function'] = $function;
      $derivative['message'] = $this
        ->t($derivative['message'], $variables);
      $derivative['description'] = $this
        ->t('Analyzes calls to @function.', $variables);
      foreach ($derivative['documentation'] as &$doc) {
        $doc['title'] = $this
          ->t($doc['title'], $variables);
      }
      unset($derivative['functions']);
      $derivatives[$function] = $derivative;
    }
  }
  return $derivatives;
}