function CategorizingPluginManagerTrait::getProviderName

Same name in other branches
  1. 9 core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php \Drupal\Core\Plugin\CategorizingPluginManagerTrait::getProviderName()
  2. 10 core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php \Drupal\Core\Plugin\CategorizingPluginManagerTrait::getProviderName()
  3. 11.x 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 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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.