You are here

protected function DerivativeDiscoveryDecorator::encodePluginId in Service Container 7

Same name and namespace in other branches
  1. 7.2 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 lib/Drupal/Component/Plugin/Discovery/DerivativeDiscoveryDecorator.php
Adds derivatives to a list of plugin definitions.

File

lib/Drupal/Component/Plugin/Discovery/DerivativeDiscoveryDecorator.php, line 158
Contains \Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator.

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;
}