protected function DerivativeDiscoveryDecorator::decodePluginId

Decodes derivative id and plugin id from a string.

Parameters

string $plugin_id: Plugin identifier that may point to a derivative plugin.

Return value

array An array with the base plugin id as the first index and the derivative id as the second. If there is no derivative id it will be null.

1 call to DerivativeDiscoveryDecorator::decodePluginId()

File

drupal/core/lib/Drupal/Component/Plugin/Discovery/DerivativeDiscoveryDecorator.php, line 94
Definition of 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 decodePluginId($plugin_id) {

  // Try and split the passed plugin definition into a plugin and a
  // derivative id. We don't need to check for !== FALSE because a leading
  // colon would break the derivative system and doesn't makes sense.
  if (strpos($plugin_id, ':')) {
    return explode(':', $plugin_id, 2);
  }
  return array(
    $plugin_id,
    NULL,
  );
}