class MailingListConfirmPermissions in Mailing List 8
Provides dynamic confirm permissions for each mailing list.
Hierarchy
- class \Drupal\mailing_list_confirm\MailingListConfirmPermissions uses UrlGeneratorTrait, StringTranslationTrait
Expanded class hierarchy of MailingListConfirmPermissions
File
- mailing_list_confirm/
src/ MailingListConfirmPermissions.php, line 12
Namespace
Drupal\mailing_list_confirmView source
class MailingListConfirmPermissions {
use StringTranslationTrait;
use UrlGeneratorTrait;
/**
* Returns an array of mailing list confirm permissions.
*
* @return array
* The mailing list confirm permissions.
*/
public function bypassConfirmPermissions() {
$perms = [];
// Generate bypass subscription confirm permission for each list.
foreach (MailingList::loadMultiple() as $list) {
$perms += $this
->buildPermissions($list);
}
return $perms;
}
/**
* Returns a list of mailing list permissions for a given list.
*
* @param \Drupal\mailing_list\Entity\MailingList $list
* The mailing list.
*
* @return array
* An associative array of permission names and descriptions.
*/
protected function buildPermissions(MailingList $list) {
$list_id = $list
->id();
$list_params = [
'%list_name' => $list
->label(),
];
return [
"bypass {$list_id} mailing list subscription confirm" => [
'title' => $this
->t('Bypass %list_name mailing list subscription confirm', $list_params),
],
];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
MailingListConfirmPermissions:: |
protected | function | Returns a list of mailing list permissions for a given list. | |
MailingListConfirmPermissions:: |
public | function | Returns an array of mailing list confirm permissions. | |
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. | |
UrlGeneratorTrait:: |
protected | property | The url generator. | |
UrlGeneratorTrait:: |
protected | function | Returns the URL generator service. | |
UrlGeneratorTrait:: |
protected | function | Returns a redirect response object for the specified route. | 3 |
UrlGeneratorTrait:: |
public | function | Sets the URL generator service. | |
UrlGeneratorTrait:: |
protected | function | Generates a URL or path for a specific route based on the given parameters. |