You are here

class LoftDataGridsPermissions in Loft Data Grids 8

Class LoftDataGridsPermissions

Define permissions for the module based on exporters.

@package Drupal\loft_data_grids

Hierarchy

Expanded class hierarchy of LoftDataGridsPermissions

File

src/LoftDataGridsPermissions.php, line 14

Namespace

Drupal\loft_data_grids
View source
class LoftDataGridsPermissions {
  use StringTranslationTrait;

  /**
   * Return the permissions defined by this module.
   *
   * @return array
   */
  public function permissions() {
    $perms = [];
    foreach (\Drupal::service('loft_data_grids.core')
      ->getExporters(false) as $exporter) {
      $perms['loft_data_grids:' . $exporter['id']] = [
        'title' => $this
          ->t('Visible in UI: @id', [
          '@id' => $exporter['name'],
        ]),
        'description' => Html::escape($exporter['description']),
      ];
    }
    return $perms;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
LoftDataGridsPermissions::permissions public function Return the permissions defined by this module.
StringTranslationTrait::$stringTranslation protected property The string translation service. 1
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.