Updated all the contrib modules to their latest versions.
[yaffs-website] / web / modules / contrib / php / src / PhpUninstallValidator.php
1 <?php
2
3 namespace Drupal\php;
4
5 use Drupal\filter\FilterUninstallValidator;
6
7 /**
8  * Remove filter preventing Php uninstall.
9  */
10 class PhpUninstallValidator extends FilterUninstallValidator {
11
12   /**
13    * {@inheritdoc}
14    */
15   public function validate($module) {
16     $reasons = [];
17     if ($module == 'php') {
18       $this->removeFilterConfig();
19     }
20     return $reasons;
21   }
22
23   /**
24    * Deletes configuration.
25    */
26   protected function removeFilterConfig() {
27     $php_filter = \Drupal::configFactory()->getEditable('filter.format.php_code');
28     $php_filter->delete();
29
30     // Clear cache.
31     drupal_flush_all_caches();
32   }
33
34 }