e93ec8cdbf8f2c11a80737ae38d15f26da96a617
[yaffs-website] / src / EnvironmentIndicatorPermissions.php
1 <?php
2
3 namespace Drupal\environment_indicator;
4
5 use Drupal\Core\StringTranslation\StringTranslationTrait;
6
7 class EnvironmentIndicatorPermissions {
8
9   use StringTranslationTrait;
10
11   /**
12    * Returns the dynamic permissions array.
13    *
14    * @return array
15    *   The permissions configuration array.
16    */
17   public function permissions() {
18     $permissions = [];
19     // TODO: Learn how to inject the EntityConfig loader.
20     // $environments = environment_indicator_get_all();
21     $environments = [];
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]),
26       ];
27     }
28     return $permissions;
29   }
30 }