function DevelHooks::formSystemModulesAlter

Implements hook_form_FORM_ID_alter() for system_modules.

Adds mouse-over hints on the Modules page to display module base names.

Attributes

#[Hook('form_system_modules_alter')]

See also

\Drupal\system\Form\ModulesListForm::buildForm()

File

src/Hook/DevelHooks.php, line 209

Class

DevelHooks
Hook implementations for devel.

Namespace

Drupal\devel\Hook

Code

public function formSystemModulesAlter(array &$form, FormStateInterface $form_state) : void {
  if ($this->currentUser
    ->hasPermission('access devel information') && $this->configFactory
    ->get('devel.settings')
    ->get('raw_names') && isset($form['modules']) && is_array($form['modules'])) {
    foreach (Element::children($form['modules']) as $group) {
      if (is_array($form['modules'][$group])) {
        foreach (Element::children($form['modules'][$group]) as $key) {
          if (isset($form['modules'][$group][$key]['name']['#markup'])) {
            $form['modules'][$group][$key]['name']['#markup'] = '<span title="' . $key . '">' . $form['modules'][$group][$key]['name']['#markup'] . '</span>';
          }
        }
      }
    }
  }
}