function DerivativeDiscoveryDecorator::decodePluginId
Same name in other branches
- 8.9.x core/lib/Drupal/Component/Plugin/Discovery/DerivativeDiscoveryDecorator.php \Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator::decodePluginId()
- 10 core/lib/Drupal/Component/Plugin/Discovery/DerivativeDiscoveryDecorator.php \Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator::decodePluginId()
- 11.x 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 132
Class
- DerivativeDiscoveryDecorator
- Base class providing the tools for a plugin discovery to be derivative aware.
Namespace
Drupal\Component\Plugin\DiscoveryCode
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 [
$plugin_id,
NULL,
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.