function public function PluginManager::getDefinitionsLike

8.x-3.x PluginManager.php public PluginManager::getDefinitionsLike($regex)

Retrieves all definitions where the plugin ID matches a certain criteria.

Parameters

string $regex: The regex pattern to match.

Return value

array[] An array of plugin definitions (empty array if no definitions were found). Keys are plugin IDs.

Class

PluginManager
Base class for Bootstrap plugin managers.

Namespace

Drupal\bootstrap\Plugin

Source src/Plugin/PluginManager.php (line 118)

public function getDefinitionsLike($regex) {
  $definitions = [];
  foreach ($this->getDefinitions() as $plugin_id => $definition) {
    if (preg_match($regex, $plugin_id)) {
      $definitions[$plugin_id] = $definition;
    }
  }
  ksort($definitions, SORT_NATURAL);
  return $definitions;
}