class DataPolicyModuleInstaller in Data Policy 8
Same name in this branch
- 8 src/DataPolicyModuleInstaller.php \Drupal\data_policy\DataPolicyModuleInstaller
- 8 src/ProxyClass/DataPolicyModuleInstaller.php \Drupal\data_policy\ProxyClass\DataPolicyModuleInstaller
Class DataPolicyModuleInstaller.
@package Drupal\data_policy
Hierarchy
- class \Drupal\Core\Extension\ModuleInstaller implements ModuleInstallerInterface
- class \Drupal\data_policy\DataPolicyModuleInstaller
Expanded class hierarchy of DataPolicyModuleInstaller
File
- src/
DataPolicyModuleInstaller.php, line 16
Namespace
Drupal\data_policyView source
class DataPolicyModuleInstaller extends ModuleInstaller {
/**
* The data policy storage.
*
* @var \Drupal\data_policy\DataPolicyStorageInterface
*/
protected $storage;
/**
* The data policy entity ID.
*
* @var int
*/
protected $entityId;
/**
* Constructs a new DataPolicyModuleInstaller instance.
*
* @param string $root
* The app root.
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* The module handler.
* @param \Drupal\Core\DrupalKernelInterface $kernel
* The drupal kernel.
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The config factory.
*/
public function __construct($root, ModuleHandlerInterface $module_handler, DrupalKernelInterface $kernel, EntityTypeManagerInterface $entity_type_manager, ConfigFactoryInterface $config_factory) {
parent::__construct($root, $module_handler, $kernel);
$this->storage = $entity_type_manager
->getStorage('data_policy');
$this->entityId = $config_factory
->get('data_policy.data_policy')
->get('entity_id');
}
/**
* {@inheritdoc}
*/
public function uninstall(array $module_list, $uninstall_dependents = TRUE) {
if (in_array('data_policy', $module_list) && $this->entityId) {
$this->storage
->load($this->entityId)
->delete();
}
parent::uninstall($module_list, $uninstall_dependents);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DataPolicyModuleInstaller:: |
protected | property | The data policy entity ID. | |
DataPolicyModuleInstaller:: |
protected | property | The data policy storage. | |
DataPolicyModuleInstaller:: |
public | function |
Uninstalls a given list of modules. Overrides ModuleInstaller:: |
|
DataPolicyModuleInstaller:: |
public | function |
Constructs a new DataPolicyModuleInstaller instance. Overrides ModuleInstaller:: |
|
ModuleInstaller:: |
protected | property | The drupal kernel. | |
ModuleInstaller:: |
protected | property | The module handler. | |
ModuleInstaller:: |
protected | property | The app root. | |
ModuleInstaller:: |
protected | property | The uninstall validators. | |
ModuleInstaller:: |
public | function |
Adds module a uninstall validator. Overrides ModuleInstallerInterface:: |
|
ModuleInstaller:: |
public | function |
Installs a given list of modules. Overrides ModuleInstallerInterface:: |
|
ModuleInstaller:: |
protected | function | Helper method for removing all cache bins registered by a given module. | |
ModuleInstaller:: |
protected | function | Updates the kernel module list. | |
ModuleInstaller:: |
public | function |
Determines whether a list of modules can be uninstalled. Overrides ModuleInstallerInterface:: |