mmeu.module in Maintenance Mode Exclude Urls 8
Same filename and directory in other branches
Module file for mmeu module.
File
mmeu.moduleView source
<?php
/**
* @file
* Module file for mmeu module.
*/
/**
* Implements hook_form_alter() for system_site_maintenance_mode().
*/
function mmeu_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
switch ($form_id) {
case 'system_site_maintenance_mode':
$config = \Drupal::config('mmeu.settings');
$form['mmeu'] = array(
'#type' => 'textarea',
'#title' => 'Exclude Urls',
'#description' => t("Enter pages to be shown to visitors in maintenance mode. Enter one page per line as Drupal paths. The * character is a wildcard. Example paths are %blog for the blog page and %blog-wildcard for every personal blog. %front is the front page.", array(
'%blog' => 'blog',
'%blog-wildcard' => 'blog/*',
'%front' => '<front>',
)),
'#default_value' => $config
->get('mmeu'),
);
$form['#submit'][] = 'mmeu_form_submit';
break;
}
}
function mmeu_form_submit(&$form, \Drupal\Core\Form\FormStateInterface $form_state) {
$config = \Drupal::configFactory()
->getEditable('mmeu.settings');
$config
->set('mmeu', trim($form_state
->getValue('mmeu')))
->save();
if ($form_state
->getValue('maintenance_mode') == 0) {
$config
->set('system_maintenance_mode', FALSE)
->save();
}
}
Functions
Name![]() |
Description |
---|---|
mmeu_form_alter | Implements hook_form_alter() for system_site_maintenance_mode(). |
mmeu_form_submit |