You are here

protected function DerivativeDiscoveryDecorator::decodePluginId in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Component/Plugin/Discovery/DerivativeDiscoveryDecorator.php \Drupal\Component\Plugin\Discovery\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()
DerivativeDiscoveryDecorator::getDefinition in core/lib/Drupal/Component/Plugin/Discovery/DerivativeDiscoveryDecorator.php

File

core/lib/Drupal/Component/Plugin/Discovery/DerivativeDiscoveryDecorator.php, line 136
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 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,
  );
}