You are here

protected function CategorizingPluginManagerTrait::getProviderName in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php \Drupal\Core\Plugin\CategorizingPluginManagerTrait::getProviderName()
  2. 9 core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php \Drupal\Core\Plugin\CategorizingPluginManagerTrait::getProviderName()

Gets the name of a provider.

Parameters

string $provider: The machine name of a plugin provider.

Return value

string The human-readable module name if it exists, otherwise the machine-readable name passed.

File

core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php, line 48

Class

CategorizingPluginManagerTrait
Provides a trait for the CategorizingPluginManagerInterface.

Namespace

Drupal\Core\Plugin

Code

protected function getProviderName($provider) {
  $list = $this
    ->getModuleHandler()
    ->getModuleList();

  // If the module exists, return its human-readable name.
  if (isset($list[$provider])) {
    return $this
      ->getModuleHandler()
      ->getName($provider);
  }

  // Otherwise, return the machine name.
  return $provider;
}