You are here

class EnvironmentIndicatorPermissions in Environment Indicator 4.x

Same name and namespace in other branches
  1. 8.3 src/EnvironmentIndicatorPermissions.php \Drupal\environment_indicator\EnvironmentIndicatorPermissions

Undocumented class.

Hierarchy

Expanded class hierarchy of EnvironmentIndicatorPermissions

File

src/EnvironmentIndicatorPermissions.php, line 10

Namespace

Drupal\environment_indicator
View source
class EnvironmentIndicatorPermissions {
  use StringTranslationTrait;

  /**
   * Returns the dynamic permissions array.
   *
   * @return array
   *   The permissions configuration array.
   */
  public function permissions() {
    $permissions = [];

    // TODO: Learn how to inject the EntityConfig loader.
    $environments = [];
    foreach ($environments as $environment) {
      $permissions['access environment indicator ' . $environment->machine] = [
        'title' => $this
          ->t('See environment indicator for %name', [
          '%name' => $environment->name,
        ]),
        'description' => $this
          ->t('See the environment indicator if the user is in the %name environment.', [
          '%name' => $environment->name,
        ]),
      ];
    }
    return $permissions;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
EnvironmentIndicatorPermissions::permissions public function Returns the dynamic permissions array.
StringTranslationTrait::$stringTranslation protected property The string translation service. 4
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.