Skip to content
Snippets Groups Projects
Commit d8e7b2c7 authored by Ismael Posada Trobo's avatar Ismael Posada Trobo
Browse files

Memcache module disabled from the Uninstall modules admin page.

parent f4d2011a
No related branches found
No related tags found
No related merge requests found
<?php <?php
/* Debugging purposes */
//function cern_integration_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) { //function cern_integration_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
//drupal_set_message(t("Form ID: $form_id"), "status"); // drupal_set_message(t("Form ID: $form_id"), "status");
//} //}
//function cern_integration_form_menu_edit_item_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
// drupal_set_message(t("Form ID: $form_id"), "status");
//}
/* Debugging purposes */
/**
* Implements hook_form_FORM_ID_alter() for system_modules_uninstall().
* Checks whether memcache module exists. If so, disable the possibility of uninstalling it. It's mandatory to have it installed.
*/
function cern_integration_form_system_modules_uninstall_alter(&$form, &$form_state, $form_id){
$moduleHandler = \Drupal::service('module_handler');
if ($moduleHandler->moduleExists('memcache')){
$form['uninstall']['memcache']['#disabled'] = TRUE;
global $base_url;
$memcache_setup_link = \Drupal\Core\Link::fromTextAndUrl('Memcache Setup', \Drupal\Core\Url::fromUri("$base_url/_site/memcache.php"))->toString();
$txt = '</br>';
$txt .= '<em>Please, do not uninstall memcache module since it can break down your site.</em>';
$txt .= '</br>';
$txt .= "<em>If you do not want to use it, please go to " . $memcache_setup_link . ".</em>";
$form['modules']['memcache']['description']['memcache_warning'] = array(
'#markup' => t($txt)
);
}
}
/** /**
* Implements hook_update_projects_alter(). * Implements hook_update_projects_alter().
* Remove Drupal core as well as all centrally managed modules and themes from the Update manager. * Remove Drupal core as well as all centrally managed modules and themes from the Update manager.
......
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