Add hook to call when protection is triggered

Created on 23 November 2023, 12 months ago
Updated 6 March 2024, 8 months ago

Problem/Motivation

It would be nice to allow other modules to take action when the protection is triggered.

Proposed resolution

Add a hook.

API changes

Add & document hook_protect_form_flood_control()

✨ Feature request
Status

Needs work

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States douggreen Winchester, VA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @douggreen
  • Status changed to Needs review 12 months ago
  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 10.1.4 + Environment: PHP 8.1 & MySQL 5.7
    last update 12 months ago
    Patch Failed to Apply
  • πŸ‡ΊπŸ‡ΈUnited States douggreen Winchester, VA

    Patch attached

  • πŸ‡«πŸ‡·France flocondetoile Lyon

    Hello. Why not let the logBlockedSubmission() in the native condition and just add an hook if the protection is trigerred ?

  • πŸ‡«πŸ‡·France flocondetoile Lyon

    Also, why use \Drupal::moduleHandler()->invokeAll().
    \Drupal::moduleHandler()->alter() looks the right way to perform this no.

    And if we use the module_handler service, we need to inject it in the manager.

  • Status changed to Needs work 9 months ago
  • πŸ‡ΊπŸ‡ΈUnited States douggreen Winchester, VA

    In response to #3 - You could keep logBlockedSubmission in the native condition, that's a design choice. I like using my own hooks as it shows other developers how to use them.

    In response to #4 - we aren't altering anything, I think invokeAll is the correct method. And yes, we should inject the module_handler.

Production build 0.71.5 2024