Implements Drupal\Component\Plugin\Discovery\DicoveryInterface::getDefinition().
Overrides DiscoveryInterface::getDefinition
public function getDefinition($plugin_id) {
// Optimize for fast access to definitions if they are already in memory.
if (isset($this->definitions)) {
// Avoid using a ternary that would create a copy of the array.
if (isset($this->definitions[$plugin_id])) {
return $this->definitions[$plugin_id];
}
else {
return;
}
}
$definitions = $this
->getDefinitions();
// Avoid using a ternary that would create a copy of the array.
if (isset($definitions[$plugin_id])) {
return $definitions[$plugin_id];
}
}