You are here

function paranoia_form_system_modules_alter in Paranoia 7

Same name and namespace in other branches
  1. 8 paranoia.module \paranoia_form_system_modules_alter()

Implements hook_form_FORM_ID_alter().

Hide Paranoia and PHP modules from module admin form.

File

./paranoia.module, line 58
Paranoia module file. Provides various extra security features.

Code

function paranoia_form_system_modules_alter(&$form, &$form_state) {
  $hidden_modules = module_invoke_all('paranoia_hide_modules');
  foreach ($hidden_modules as $module => $package) {

    // Unset instead of using #access because #access => FALSE shows an empty
    // table row.
    if (isset($form['modules'][$module])) {
      unset($form['modules'][$module]);
    }

    // Adds support for module_filter.
    if (isset($form['modules'][$package][$module])) {
      unset($form['modules'][$package][$module]);
    }
  }

  // Invoke custom validation function to disable banned modules on submit.
  $form['#validate'][] = 'paranoia_module_validate';
}