Allow other modules to opt-in forms for antibot

Created on 30 November 2020, about 4 years ago
Updated 6 September 2024, 3 months ago

Problem/Motivation

I want modules to be able to add / alter form ids to protect.

Proposed resolution

Add a suitable collect / alter hook.

Remaining tasks

Do it.

User interface changes

None.

API changes

New hook added.

Data model changes

None.

πŸ“Œ Task
Status

Needs review

Version

2.0

Component

Code

Created by

πŸ‡©πŸ‡ͺGermany geek-merlin Freiburg, Germany

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

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡§πŸ‡ͺBelgium svendecabooter Gent

    Use case would be having a specific module that generates its form_id dynamically, or has a lot of forms with different IDs.
    In the first case, the administrator could not enable Antibot for these forms, since they cannot add all dynamically generated form IDs to the antibot settings. In the second case, they would need to add a lot of form IDs manually.

    Providing a hook would solve this issue, if the specific module would implement this hook and provide its form_ids to it. This would automatically enable Antibot on all of the forms by "specific module", without a site administrator having to configure something.

    Ideally the hook would not alter the form_ids, but just decide whether the form_id the hook is called for, should use Antibot or not.
    That way, the specific module could just return TRUE for all form_ids starting with e.g. "specific_form_"

  • First commit to issue fork.
  • Status changed to Needs review almost 2 years ago
  • πŸ‡§πŸ‡·Brazil paulocs Belo Horizonte

    I have created a PR to create the hook. I think we can add the hook as @svendecabooter provided some useful use cases.

  • Status changed to RTBC almost 2 years ago
  • πŸ‡§πŸ‡·Brazil hmendes

    Thanks @paulocs.
    Tested the code here locally and it worked for me. I did a simple implementation on a custom module setting the protection to TRUE on a specific form and it worked.

    Tested with Drupal 9.5.1 and antibot 2.0.x-dev. Changing to RTBC.

  • πŸ‡«πŸ‡·France xavier.masson Haute-Normandie

    xavier.masson β†’ made their first commit to this issue’s fork.

  • Status changed to Needs review 3 months ago
  • πŸ‡«πŸ‡·France xavier.masson Haute-Normandie

    I've rebased the MR !13 with latest version of 2.0.x, i've needed to adapt the previous code from changes of 2.0.x branch, any to review ?

Production build 0.71.5 2024