PhpUninstallValidator.php in PHP 8
Namespace
Drupal\phpFile
src/PhpUninstallValidator.phpView source
<?php
namespace Drupal\php;
use Drupal\filter\FilterUninstallValidator;
/**
* Remove filter preventing Php uninstall.
*/
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();
}
}
Classes
Name | Description |
---|---|
PhpUninstallValidator | Remove filter preventing Php uninstall. |