You are here

public function PurgersService::getLabels in Purge 8.3

Retrieve all user-readable labels for all enabled purger instances.

Return value

\Drupal\Core\StringTranslation\TranslatableMarkup[] Associative array with instance ID's in the key and the label as value.

Overrides PurgersServiceInterface::getLabels

See also

\Drupal\purge\Plugin\Purge\Purger\PurgerInterface::getId()

\Drupal\purge\Plugin\Purge\Purger\PurgerInterface::getLabel()

File

src/Plugin/Purge/Purger/PurgersService.php, line 215

Class

PurgersService
Provides the service that distributes access to one or more purgers.

Namespace

Drupal\purge\Plugin\Purge\Purger

Code

public function getLabels() {
  if (is_null($this->labels)) {
    $this
      ->initializePurgers();
    $this->labels = [];
    foreach ($this
      ->getPluginsEnabled() as $id => $plugin_id) {
      $this->labels[$id] = $this->purgers[$id]
        ->getLabel();
    }
  }
  return $this->labels;
}