You are here

class PhpUninstallValidator in PHP 8

Remove filter preventing Php uninstall.

Hierarchy

Expanded class hierarchy of PhpUninstallValidator

1 string reference to 'PhpUninstallValidator'
php.services.yml in ./php.services.yml
php.services.yml
1 service uses PhpUninstallValidator
filter.uninstall_validator in ./php.services.yml
Drupal\php\PhpUninstallValidator

File

src/PhpUninstallValidator.php, line 10

Namespace

Drupal\php
View source
class PhpUninstallValidator extends FilterUninstallValidator {

  /**
   * {@inheritdoc}
   */
  public function validate($module) {
    $reasons = [];
    if ($module == 'php') {
      $this
        ->removeFilterConfig();
    }
    return $reasons;
  }

  /**
   * Deletes configuration.
   */
  protected function removeFilterConfig() {
    $php_filter = \Drupal::configFactory()
      ->getEditable('filter.format.php_code');
    $php_filter
      ->delete();

    // Clear cache.
    drupal_flush_all_caches();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
FilterUninstallValidator::$filterManager protected property The filter plugin manager.
FilterUninstallValidator::$filterStorage protected property The filter entity storage.
FilterUninstallValidator::getEnabledFilterFormats protected function Returns all enabled filter formats.
FilterUninstallValidator::getFilterDefinitionsByProvider protected function Returns all filter definitions that are provided by the specified provider.
FilterUninstallValidator::__construct public function Constructs a new FilterUninstallValidator.
PhpUninstallValidator::removeFilterConfig protected function Deletes configuration.
PhpUninstallValidator::validate public function Determines the reasons a module can not be uninstalled. Overrides FilterUninstallValidator::validate
StringTranslationTrait::$stringTranslation protected property The string translation service. 1
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.