class PubSubModuleStatusChecker in Acquia Content Hub 8.2
Utility class; encapsulates static general-purpose methods.
@package Drupal\acquia_contenthub
Hierarchy
- class \Drupal\acquia_contenthub\PubSubModuleStatusChecker
Expanded class hierarchy of PubSubModuleStatusChecker
4 files declare their use of PubSubModuleStatusChecker
- PruneImportedEntitiesFromExport.php in modules/
acquia_contenthub_subscriber/ src/ EventSubscriber/ PrunePublishEntities/ PruneImportedEntitiesFromExport.php - PruneImportedEntitiesFromExportTest.php in tests/
src/ Kernel/ EventSubscriber/ ExportUnownedContentOnDualConfigSites/ PruneImportedEntitiesFromExportTest.php - PublisherSubscriberStatusCdfAttribute.php in src/
EventSubscriber/ CdfAttributes/ PublisherSubscriberStatusCdfAttribute.php - PublisherSubscriberStatusCdfAttributeTest.php in tests/
src/ Unit/ EventSubscriber/ CdfAttributes/ PublisherSubscriberStatusCdfAttributeTest.php
1 string reference to 'PubSubModuleStatusChecker'
1 service uses PubSubModuleStatusChecker
File
- src/
PubSubModuleStatusChecker.php, line 12
Namespace
Drupal\acquia_contenthubView source
class PubSubModuleStatusChecker {
public const ACQUIA_CONTENTHUB_PUBLISHER_MODULE_ID = 'acquia_contenthub_publisher';
public const ACQUIA_CONTENTHUB_SUBSCRIBER_MODULE_ID = 'acquia_contenthub_subscriber';
/**
* Module handler.
*
* @var \Drupal\Core\Extension\ModuleHandler
*/
protected $moduleHandlerService;
/**
* PubSubModuleStatusChecker constructor.
*
* @param \Drupal\Core\Extension\ModuleHandler $module_handler_service
* Module Handler Service.
*/
public function __construct(ModuleHandler $module_handler_service) {
$this->moduleHandlerService = $module_handler_service;
}
/**
* Determines if publisher module is installed and enabled.
*
* @return bool
* Is the module enabled?
*/
public function isPublisher() : bool {
return $this
->moduleEnabled(self::ACQUIA_CONTENTHUB_PUBLISHER_MODULE_ID);
}
/**
* Determines if subscriber module is installed and enabled.
*
* @return bool
* Is the module enabled?
*/
public function isSubscriber() : bool {
return $this
->moduleEnabled(self::ACQUIA_CONTENTHUB_SUBSCRIBER_MODULE_ID);
}
/**
* Checks if site has dual configuration (pub/sub).
*
* @return bool
* Are both modules enabled?
*/
public function siteHasDualConfiguration() : bool {
return $this
->isSubscriber() && $this
->isPublisher();
}
/**
* Determines if a module is installed and enabled.
*
* @param string $module_id
* Id of the module.
*
* @return bool
* Does the module exist?
*/
private function moduleEnabled(string $module_id) : bool {
return $this->moduleHandlerService
->moduleExists($module_id);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PubSubModuleStatusChecker:: |
protected | property | Module handler. | |
PubSubModuleStatusChecker:: |
public | constant | ||
PubSubModuleStatusChecker:: |
public | constant | ||
PubSubModuleStatusChecker:: |
public | function | Determines if publisher module is installed and enabled. | |
PubSubModuleStatusChecker:: |
public | function | Determines if subscriber module is installed and enabled. | |
PubSubModuleStatusChecker:: |
private | function | Determines if a module is installed and enabled. | |
PubSubModuleStatusChecker:: |
public | function | Checks if site has dual configuration (pub/sub). | |
PubSubModuleStatusChecker:: |
public | function | PubSubModuleStatusChecker constructor. |