3 namespace Drupal\environment_indicator;
5 use Drupal\Core\StringTranslation\StringTranslationTrait;
7 class EnvironmentIndicatorPermissions {
9 use StringTranslationTrait;
12 * Returns the dynamic permissions array.
15 * The permissions configuration array.
17 public function permissions() {
19 // TODO: Learn how to inject the EntityConfig loader.
20 // $environments = environment_indicator_get_all();
22 foreach ($environments as $machine => $environment) {
23 $permissions['access environment indicator ' . $environment->machine] = [
24 'title' => $this->t('See environment indicator for %name', ['%name' => $environment->name]),
25 'description' => $this->t('See the environment indicator if the user is in the %name environment.', ['%name' => $environment->name]),