You are here

protected function DerivativeDiscoveryDecorator::encodePluginId in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Component/Plugin/Discovery/DerivativeDiscoveryDecorator.php \Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator::encodePluginId()
  2. 9 core/lib/Drupal/Component/Plugin/Discovery/DerivativeDiscoveryDecorator.php \Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator::encodePluginId()

Encodes plugin and derivative id's into a string.

Parameters

string $base_plugin_id: The base plugin identifier.

string $derivative_id: The derivative identifier.

Return value

string A uniquely encoded combination of the $base_plugin_id and $derivative_id.

1 call to DerivativeDiscoveryDecorator::encodePluginId()
DerivativeDiscoveryDecorator::getDerivatives in core/lib/Drupal/Component/Plugin/Discovery/DerivativeDiscoveryDecorator.php
Adds derivatives to a list of plugin definitions.

File

core/lib/Drupal/Component/Plugin/Discovery/DerivativeDiscoveryDecorator.php, line 154

Class

DerivativeDiscoveryDecorator
Base class providing the tools for a plugin discovery to be derivative aware.

Namespace

Drupal\Component\Plugin\Discovery

Code

protected function encodePluginId($base_plugin_id, $derivative_id) {
  if ($derivative_id) {
    return "{$base_plugin_id}:{$derivative_id}";
  }

  // By returning the unmerged plugin_id, we are able to support derivative
  // plugins that support fetching the base definitions.
  return $base_plugin_id;
}