You are here

class Permissions in Display Suite 8.4

Same name and namespace in other branches
  1. 8.2 modules/ds_switch_view_mode/src/Permissions.php \Drupal\ds_switch_view_mode\Permissions
  2. 8.3 modules/ds_switch_view_mode/src/Permissions.php \Drupal\ds_switch_view_mode\Permissions

Provides dynamic permissions of the ds switch view mode module.

Hierarchy

Expanded class hierarchy of Permissions

File

modules/ds_switch_view_mode/src/Permissions.php, line 10

Namespace

Drupal\ds_switch_view_mode
View source
class Permissions {
  use StringTranslationTrait;

  /**
   * Constructs a Permissions object.
   */
  public function __construct() {

    // Empty constructor to prevent php 4 constructor error.
  }

  /**
   * Returns an array of ds switch view mode permissions.
   */
  public function permissions() {
    $permissions = [];
    foreach (node_type_get_names() as $key => $name) {
      $permissions['ds switch ' . $key] = [
        'title' => $this
          ->t('Switch view modes on :type', [
          ':type' => $name,
        ]),
      ];
    }
    return $permissions;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Permissions::permissions public function Returns an array of ds switch view mode permissions.
Permissions::__construct public function Constructs a Permissions object.
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.