abstract class ListBase in Plugin 8.2
Handles the listing routes.
Hierarchy
- class \Drupal\plugin\Controller\ListBase implements ContainerInjectionInterface uses StringTranslationTrait
Expanded class hierarchy of ListBase
File
- src/
Controller/ ListBase.php, line 14
Namespace
Drupal\plugin\ControllerView source
abstract class ListBase implements ContainerInjectionInterface {
use StringTranslationTrait;
/**
* The module handler.
*
* @var \Drupal\Core\Extension\ModuleHandlerInterface
*/
protected $moduleHandler;
/**
* Constructs a new class instance.
*
* @param \Drupal\Core\StringTranslation\TranslationInterface $string_translation
* The string translator.
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* The module handler.
*/
public function __construct(TranslationInterface $string_translation, ModuleHandlerInterface $module_handler) {
$this->moduleHandler = $module_handler;
$this->stringTranslation = $string_translation;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static($container
->get('string_translation'), $container
->get('module_handler'));
}
/**
* Gets the human-readable provider label.
*
* @param $provider string
*
* @return string
*/
protected function getProviderLabel($provider) {
if ($provider == 'core') {
return $this
->t('Core');
}
else {
return $this->moduleHandler
->getName($provider);
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ListBase:: |
protected | property | The module handler. | |
ListBase:: |
public static | function |
Instantiates a new instance of this class. Overrides ContainerInjectionInterface:: |
2 |
ListBase:: |
protected | function | Gets the human-readable provider label. | |
ListBase:: |
public | function | Constructs a new class instance. | 2 |
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |