You are here

protected function CategorizingPluginManagerTrait::getProviderName in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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.

1 call to CategorizingPluginManagerTrait::getProviderName()
CategorizingPluginManagerTrait::processDefinitionCategory in core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php
Processes a plugin definition to ensure there is a category.

File

core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php, line 53
Contains \Drupal\Core\Plugin\CategorizingPluginManagerTrait.

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