You are here

class QuickNodeClonePermissions in Quick Node Clone 8

Module permissions.

Hierarchy

Expanded class hierarchy of QuickNodeClonePermissions

File

src/QuickNodeClonePermissions.php, line 11

Namespace

Drupal\quick_node_clone
View source
class QuickNodeClonePermissions {
  use StringTranslationTrait;

  /**
   * Returns an array of permissions.
   *
   * @return array
   *   The permissions.
   *
   * @see \Drupal\user\PermissionHandlerInterface::getPermissions()
   */
  public function cloneTypePermissions() {
    $perms = [];

    // Generate node permissions for all node types.
    foreach (NodeType::loadMultiple() as $type) {
      $type_id = $type
        ->id();
      $type_params = [
        '%type' => $type
          ->label(),
      ];
      $perms += [
        "clone {$type_id} content" => [
          'title' => $this
            ->t('%type: clone content', $type_params),
        ],
      ];
    }
    return $perms;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
QuickNodeClonePermissions::cloneTypePermissions public function Returns an array of permissions.
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.