You are here

protected function BootstrapLayoutsManager::findDefinitions in Bootstrap Layouts 8.4

Same name and namespace in other branches
  1. 8.5 src/BootstrapLayoutsManager.php \Drupal\bootstrap_layouts\BootstrapLayoutsManager::findDefinitions()

Finds plugin definitions.

Return value

array List of definitions to store in cache.

Overrides DefaultPluginManager::findDefinitions

File

src/BootstrapLayoutsManager.php, line 76

Class

BootstrapLayoutsManager
Class BootstrapLayoutsManager

Namespace

Drupal\bootstrap_layouts

Code

protected function findDefinitions() {
  $definitions = parent::findDefinitions();

  // The handler plugin identifiers represent the module or theme that
  // implements said layouts. Remove any handler plugins that not installed.
  foreach (array_keys($definitions) as $provider) {
    if (!$this
      ->providerExists($provider)) {
      unset($definitions[$provider]);
    }
    else {

      // Attempt to retrieve the theme human readable label first.
      try {
        $label = $this->themeHandler
          ->getName($provider);
      } catch (\Exception $e) {
        $label = $this->moduleHandler
          ->getName($provider);
      }
      $definitions[$provider]['label'] = $label;
    }
  }
  return $definitions;
}