Skip to content
Snippets Groups Projects
Commit ba123084 authored by Gábor Hojtsy's avatar Gábor Hojtsy
Browse files

Issue #3016061 by Anybody, tarunyaduvanshi, hass, apaderno, Gábor Hojtsy,...

Issue #3016061 by Anybody, tarunyaduvanshi, hass, apaderno, Gábor Hojtsy, GNUMatrix, saurabh.rocksoul, Joshua_Lim, finaukaufusi, makbul_khan8: Text format with system name "php_code" is deleted when you view admin/modules/uninstall
parent df05bd62
No related branches found
No related tags found
No related merge requests found
services:
filter.uninstall_validator:
class: Drupal\php\PhpUninstallValidator
tags:
- { name: module_install.uninstall_validator }
arguments: ['@plugin.manager.filter', '@entity_type.manager', '@string_translation']
lazy: false
<?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();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment