Loading honeypot.module +25 −0 Original line number Diff line number Diff line Loading @@ -8,6 +8,7 @@ use Drupal\Core\Form\FormStateInterface; use Drupal\Component\Utility\Crypt; use Drupal\Core\Routing\RouteMatchInterface; use Drupal\Core\Url; /** * Implements hook_help(). Loading Loading @@ -40,6 +41,30 @@ function honeypot_cron() { ->execute(); } /** * Implements hook_form_FORM_ID_alter(). */ function honeypot_form_system_performance_settings_alter(&$form, FormStateInterface $form_state, $form_id) { // If time-based protection is effectively disabled, no need for a warning. if (\Drupal::config('honeypot.settings')->get('time_limit') === 0) { return; } // Add a warning about caching on the Performance settings page. $description = ''; if (!empty($form['caching']['page_cache_maximum_age']['#description'])) { // If there's existing description on 'caching' field, append a break to it // so that our verbiage is on its own line. $description .= $form['caching']['page_cache_maximum_age']['#description'] . '<br />'; } $description .= t('<em>Page caching may be disabled on any pages where a form is present due to the <a href=":url">Honeypot module\'s configuration</a>.</em>', [ ':url' => Url::fromRoute('honeypot.config')->toString(), ]); $form['caching']['page_cache_maximum_age']['#description'] = $description; } /** * Implements hook_form_alter(). * Loading Loading
honeypot.module +25 −0 Original line number Diff line number Diff line Loading @@ -8,6 +8,7 @@ use Drupal\Core\Form\FormStateInterface; use Drupal\Component\Utility\Crypt; use Drupal\Core\Routing\RouteMatchInterface; use Drupal\Core\Url; /** * Implements hook_help(). Loading Loading @@ -40,6 +41,30 @@ function honeypot_cron() { ->execute(); } /** * Implements hook_form_FORM_ID_alter(). */ function honeypot_form_system_performance_settings_alter(&$form, FormStateInterface $form_state, $form_id) { // If time-based protection is effectively disabled, no need for a warning. if (\Drupal::config('honeypot.settings')->get('time_limit') === 0) { return; } // Add a warning about caching on the Performance settings page. $description = ''; if (!empty($form['caching']['page_cache_maximum_age']['#description'])) { // If there's existing description on 'caching' field, append a break to it // so that our verbiage is on its own line. $description .= $form['caching']['page_cache_maximum_age']['#description'] . '<br />'; } $description .= t('<em>Page caching may be disabled on any pages where a form is present due to the <a href=":url">Honeypot module\'s configuration</a>.</em>', [ ':url' => Url::fromRoute('honeypot.config')->toString(), ]); $form['caching']['page_cache_maximum_age']['#description'] = $description; } /** * Implements hook_form_alter(). * Loading