class CampaignMonitorUserManager in Campaign Monitor 8.2
Manager for Campaignmonitor subscriptions.
Hierarchy
- class \Drupal\campaignmonitor\CampaignMonitorManager uses StringTranslationTrait
- class \Drupal\campaignmonitor_user\CampaignMonitorUserManager
Expanded class hierarchy of CampaignMonitorUserManager
1 file declares its use of CampaignMonitorUserManager
- CampaignMonitorUserController.php in modules/
campaignmonitor_user/ src/ Controller/ CampaignMonitorUserController.php
1 string reference to 'CampaignMonitorUserManager'
- campaignmonitor_user.services.yml in modules/
campaignmonitor_user/ campaignmonitor_user.services.yml - modules/campaignmonitor_user/campaignmonitor_user.services.yml
1 service uses CampaignMonitorUserManager
- campaignmonitor_user.manager in modules/
campaignmonitor_user/ campaignmonitor_user.services.yml - Drupal\campaignmonitor_user\CampaignMonitorUserManager
File
- modules/
campaignmonitor_user/ src/ CampaignMonitorUserManager.php, line 15
Namespace
Drupal\campaignmonitor_userView source
class CampaignMonitorUserManager extends CampaignMonitorManager {
/**
* The campaignmonitor manager.
*
* @var \Drupal\campaignmonitor\CampaignMonitorManager
*/
protected $campaignMonitorManager;
/**
* Drupal\Core\Config\ConfigFactoryInterface definition.
*
* @var \Drupal\Core\Config\ConfigFactoryInterface
*/
protected $configFactory;
/**
* The language manager service.
*
* @var \Drupal\Core\Language\LanguageManagerInterface
*/
protected $languageManager;
/**
* The module manager service.
*
* @var \Drupal\Core\Extension\ModuleHandlerInterface
*/
protected $moduleHandler;
/**
* The current user.
*
* @var \Drupal\Core\Session\AccountProxyInterface
*/
protected $account;
/**
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;
/**
* The constructor.
*
* @param \Drupal\campaignmonitor\CampaignMonitorManager $campaignmonitor_manager
* The campaign monitor manager.
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The config factory.
* @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
* The language manager service.
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* The module handler.
* @param \Drupal\Core\Session\AccountProxyInterface $account
* The account interface.
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
*/
public function __construct(CampaignMonitorManager $campaignmonitor_manager, ConfigFactoryInterface $config_factory, LanguageManagerInterface $language_manager, ModuleHandlerInterface $module_handler, AccountProxyInterface $account, EntityTypeManagerInterface $entity_type_manager) {
$this->campaignMonitorManager = $campaignmonitor_manager;
$this->languageManager = $language_manager;
$this->moduleHandler = $module_handler;
$this->configFactory = $config_factory;
// Get account information.
$this->config = $config_factory
->get('campaignmonitor.settings');
$this->account = $account;
$this->entityTypeManager = $entity_type_manager;
}
/**
* Helper function to get a user's subscriptions.
*
* @param string $email
* The user mail id.
* @param string $format
* Return value depends on format requested.
*
* @return array
* list names.
*/
public function getUserSubscriptions($email, $format = 'checkboxes') {
$lists = $this->campaignMonitorManager
->getLists();
// Build options for the form selector.
$options = [];
$default = [];
foreach ($lists as $list_id => $list) {
// Check if the list is selected to be shown.
// $list_options = $this->campaignMonitorManager
// ->getListSettings($list_id);.
if ($this->campaignMonitorManager
->isListEnabled($list_id)) {
// Check if the user is subscribed to the current list.
$default[$list_id] = 0;
if ($this->campaignMonitorManager
->isSubscribed($list_id, $email)) {
$default[$list_id] = $list_id;
$options[$list_id] = $list['name'];
}
}
}
switch ($format) {
case 'checkboxes':
return $default;
default:
return $options;
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CampaignMonitorManager:: |
protected | property | Stores the api key. | |
CampaignMonitorManager:: |
protected | property | The cache backend service. | |
CampaignMonitorManager:: |
protected | property | This variable is used to store campaign data in cache. | |
CampaignMonitorManager:: |
protected | property | Stores the client id. | |
CampaignMonitorManager:: |
protected | property | Config settings. | |
CampaignMonitorManager:: |
protected | property | This variable is used to store draft data. | |
CampaignMonitorManager:: |
protected | property | This variable stores the errors. | |
CampaignMonitorManager:: |
protected static | property | Holds the object instance (part of the singleton pattern). | |
CampaignMonitorManager:: |
protected | property | These variables are used as static cache for the object. | |
CampaignMonitorManager:: |
protected | property | List stats. | |
CampaignMonitorManager:: |
protected | property | Tells if there is any log errors. | |
CampaignMonitorManager:: |
protected | property | The logger service. | |
CampaignMonitorManager:: |
protected | property | This variables used to store the subscriber details. | |
CampaignMonitorManager:: |
protected | function | Add an error to the local stack and call watchdog, if logging is enabled. | |
CampaignMonitorManager:: |
public | function | Clears all the caches used by this wrapper object. | |
CampaignMonitorManager:: |
public | function | Create API client object. | |
CampaignMonitorManager:: |
public | function | Create a new list at the Campaign Monitor servers. | |
CampaignMonitorManager:: |
protected | function | Create API list object. | |
CampaignMonitorManager:: |
protected | function | Create API subscribers object. | |
CampaignMonitorManager:: |
public | function | Delete a list from Campaign Monitor. | |
CampaignMonitorManager:: |
protected | function | Create a UNIX timestamp based on the cache timeout from admin interface. | |
CampaignMonitorManager:: |
public | function | Get basic information about campaigns in the form of a keyed array. | |
CampaignMonitorManager:: |
public static | function | Implements a singleton pattern that returns an instance of this object. | |
CampaignMonitorManager:: |
public | function | Fetch custom fields for a given list. | |
CampaignMonitorManager:: |
public | function | Get basic information about drafts in the form of a keyed array. | |
CampaignMonitorManager:: |
public | function | Returns the internal error array with the format below. | |
CampaignMonitorManager:: |
public | function | Get all information available about a given list. | |
CampaignMonitorManager:: |
public | function | Gets the latest error from the stack of possible errors. | |
CampaignMonitorManager:: |
public | function | Gets list details from Campaign Monitor. | |
CampaignMonitorManager:: |
public | function | Gets all CM lists found under the client ID given during object creation. | |
CampaignMonitorManager:: |
public | function | Gets the settings for a list. | |
CampaignMonitorManager:: |
public | function | Fetch stats about a given list including subscribers and unsubscribers. | |
CampaignMonitorManager:: |
public | function | Get values entered by the subscriber, when subscribing to a list. | |
CampaignMonitorManager:: |
public | function | Checks if the list given by id is enabled locally. | |
CampaignMonitorManager:: |
public | function | Check if user, identified by e-mail, is subscribed to a given list. | |
CampaignMonitorManager:: |
public | function | Helper function to determine config var name for list options. | |
CampaignMonitorManager:: |
public | function | Remove subscribers from local cache. | |
CampaignMonitorManager:: |
public | function | Resets the internal error array to an empty array. | |
CampaignMonitorManager:: |
public | function | Sets the config for a list. | |
CampaignMonitorManager:: |
public | function | Subscribe a user to a given list, with information entered. | |
CampaignMonitorManager:: |
public | function | Unsubscribe a given user, identified by e-mail address, from a given list. | |
CampaignMonitorManager:: |
public | function | Update remote list information. | |
CampaignMonitorManager:: |
public | function | Updates the subscriber e-mail address for a given list. | |
CampaignMonitorUserManager:: |
protected | property | The current user. | |
CampaignMonitorUserManager:: |
protected | property | The campaignmonitor manager. | |
CampaignMonitorUserManager:: |
protected | property |
Drupal\Core\Config\ConfigFactoryInterface definition. Overrides CampaignMonitorManager:: |
|
CampaignMonitorUserManager:: |
protected | property | The entity type manager. | |
CampaignMonitorUserManager:: |
protected | property |
The language manager service. Overrides CampaignMonitorManager:: |
|
CampaignMonitorUserManager:: |
protected | property |
The module manager service. Overrides CampaignMonitorManager:: |
|
CampaignMonitorUserManager:: |
public | function | Helper function to get a user's subscriptions. | |
CampaignMonitorUserManager:: |
public | function |
The constructor. Overrides CampaignMonitorManager:: |
|
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. |