You are here

function paranoia_form_system_modules_uninstall_alter in Paranoia 8

Implements hook_form_FORM_ID_alter().

Hides designated modules from the module uninstall form.

File

./paranoia.module, line 56
Disables PHP block visibility permission and gives status error if a role has this permission. Disables the PHP module. Hides the PHP and paranoia modules from the modules page. Prevents user/1 editing which could give access to abitrary contrib…

Code

function paranoia_form_system_modules_uninstall_alter(&$form, FormStateInterface $form_state) {
  $hidden_modules = \Drupal::moduleHandler()
    ->invokeAll('paranoia_hide_modules');
  foreach ($hidden_modules as $module) {
    if (isset($form['modules'][$module])) {
      unset($form['modules'][$module]);
    }
  }
}