You are here

public function PluginManager::getDefinitionsLike in Express 8

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.

File

themes/contrib/bootstrap/src/Plugin/PluginManager.php, line 122
Contains \Drupal\bootstrap\Plugin\PluginManager.

Class

PluginManager
Base class for Bootstrap plugin managers.

Namespace

Drupal\bootstrap\Plugin

Code

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;
}