You are here

class ModuleInstaller in Service Container 7

Same name and namespace in other branches
  1. 7.2 src/Extension/ModuleInstaller.php \Drupal\service_container\Extension\ModuleInstaller

Provides a module installer compatible with D7.

@codeCoverageIgnore

Hierarchy

Expanded class hierarchy of ModuleInstaller

File

src/Extension/ModuleInstaller.php, line 19
Contains \Drupal\service_container\Extension\ModuleInstaller.

Namespace

Drupal\service_container\Extension
View source
class ModuleInstaller implements ModuleInstallerInterface {

  /**
   * The Drupal7 service.
   *
   * @var \Drupal\service_container\Legacy\Drupal7
   */
  protected $drupal7;

  /**
   * Constructs a new ModuleInstaller instance.
   *
   * @param \Drupal\service_container\Legacy\Drupal7 $drupal7
   *   The Drupal7 service.
   */
  public function __construct(Drupal7 $drupal7) {
    $this->drupal7 = $drupal7;
  }

  /**
   * {@inheritdoc}
   */
  public function install(array $module_list, $enable_dependencies = TRUE) {
    $this->drupal7
      ->module_enable($module_list, $enable_dependencies);
  }

  /**
   * {@inheritdoc}
   */
  public function uninstall(array $module_list, $uninstall_dependents = TRUE) {
    $this->drupal7
      ->module_disable($module_list, $uninstall_dependents);
    $this->drupal7
      ->drupal_uninstall_modules($module_list);
  }

  /**
   * {@inheritdoc}
   */
  public function addUninstallValidator(ModuleUninstallValidatorInterface $uninstall_validator) {
    throw new \BadMethodCallException(sprintf('%s is not implemented', __FUNCTION__));
  }

  /**
   * {@inheritdoc}
   */
  public function validateUninstall(array $module_list) {
    throw new \BadMethodCallException(sprintf('%s is not implemented', __FUNCTION__));
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ModuleInstaller::$drupal7 protected property The Drupal7 service.
ModuleInstaller::addUninstallValidator public function Adds module a uninstall validator. Overrides ModuleInstallerInterface::addUninstallValidator
ModuleInstaller::install public function Installs a given list of modules. Overrides ModuleInstallerInterface::install
ModuleInstaller::uninstall public function Uninstalls a given list of modules. Overrides ModuleInstallerInterface::uninstall
ModuleInstaller::validateUninstall public function Determines whether a list of modules can be uninstalled. Overrides ModuleInstallerInterface::validateUninstall
ModuleInstaller::__construct public function Constructs a new ModuleInstaller instance.