FZ152

Helps Russian websites comply with Federal Law 152 on personal data protection by adding consent checkboxes to forms and providing a privacy policy page.

fz152
1,448 sites
22
drupal.org

Install

Drupal 11, 10 v2.0.0
composer require 'drupal/fz152:^2.0'
Drupal 9, 8 v8.x-1.10
composer require 'drupal/fz152:8.x-1.10'

Overview

FZ152 is a Drupal module designed to help websites comply with Russian Federal Law 152, which regulates the collection, storage, and processing of personal data. The law requires websites to obtain explicit user consent before collecting personal information and to display a privacy policy.

This module provides two main features: First, it automatically adds a customizable 'I agree to process my personal data' checkbox to any forms you specify, with support for wildcards in form IDs. Second, it creates a dedicated privacy policy page at a configurable path (default: /privacy-policy) with a pre-written legal agreement template in Russian that can be customized through the admin UI.

The module includes a plugin system that allows other modules to integrate their forms, with a bundled submodule for Drupal's Contact module. All settings are fully translatable, allowing different configurations per language, and you can even disable the functionality for specific languages while keeping it enabled for others.

Features

  • Adds a 'consent to process personal data' checkbox to any specified Drupal forms with customizable label text supporting HTML links
  • Provides a configurable privacy policy page at /privacy-policy with a complete Russian legal agreement template that complies with FZ152
  • Supports wildcards in form IDs (e.g., *_node_form) to easily target multiple similar forms at once
  • Allows setting custom weight/position for the checkbox in each form to control where it appears
  • Fully translatable with the ability to enable/disable functionality per language for multilingual sites
  • Includes a plugin system allowing other modules to register their forms for consent checkbox integration
  • Bundled submodule for Contact module integration that adds checkboxes to contact forms via UI
  • Option to display consent as plain text instead of a checkbox when appropriate
  • Customizable privacy policy page path that can be different per language
  • Privacy policy page can be disabled if you prefer to use your own page

Use Cases

Russian e-commerce site compliance

An online store operating in Russia needs to comply with FZ152 before collecting any customer data. Install FZ152, enable it for all checkout and registration forms using wildcards like '*_checkout_form' and 'user_register_form', and customize the privacy policy page with your company-specific information.

Multilingual site with selective enforcement

A site serving both Russian and international audiences can enable FZ152 only for the Russian language version. Configure the module with 'Enable functionality' checked in Russian translation only, while other languages won't show the consent checkbox.

Contact form compliance

Enable the fz152_contact submodule to automatically add consent checkboxes to all your site's contact forms. Go to /admin/config/system/fz152/contact to individually enable/disable checkboxes per contact form type.

Custom form integration

For custom module forms, simply add the form ID to the Forms configuration page at /admin/config/system/fz152/forms. Use the pattern 'mymodule_custom_form|50' to also control where the checkbox appears in your form.

Node creation forms

Add consent checkboxes to all node creation/edit forms using the wildcard '*_node_form' to match any content type form where users might input personal data.

Tips

  • Use wildcards like *_form or *_node_form to target multiple similar forms at once without listing each one individually
  • The checkbox label supports HTML - include a link to your privacy policy page using <a href="/privacy-policy">link text</a>
  • You can set different privacy policy paths for different languages via translation - useful for multilingual sites
  • If you prefer to use your own privacy policy page, simply disable the built-in page in Page settings and update the checkbox label link accordingly
  • The default Russian privacy policy text is legally compliant and can be used as-is for most websites, saving you from needing a lawyer to draft one
  • When adding weight to form IDs (e.g., form_id|99), lower numbers appear higher in the form while higher numbers push the checkbox toward the bottom

Technical Details

Admin Pages 4
Adjust settings for FZ152 /admin/config/system/fz152

Main configuration page for the FZ152 module where you can enable/disable the consent checkbox functionality and customize the checkbox label text.

Page settings /admin/config/system/fz152/settings

Configure the privacy policy page settings including the page path, title, and content.

Forms /admin/config/system/fz152/forms

Specify which Drupal forms should display the consent checkbox. Supports wildcards and custom weight settings.

Contact /admin/config/system/fz152/contact

Configure which Contact forms should display the consent checkbox. Only available when the FZ152 — Contact submodule is enabled.

Permissions 1
Administer FZ152 settings

Allows users to configure FZ152 module settings including checkbox text, form selection, and privacy policy page content.

Hooks 1
hook_fz152_info_alter

Allows modules to alter the FZ152 plugin definitions before they are cached.

Troubleshooting 4
Checkbox not appearing on expected forms

Verify the form ID is correctly entered at /admin/config/system/fz152/forms. Check that 'Enable functionality' is checked in main settings. For Webform, ensure you're using the correct form ID pattern.

Privacy policy page returns 404

Clear the cache after changing the page path. Ensure 'Enable privacy policy page' is checked in Page settings. The route may need rebuilding - save the Page settings form again.

Checkbox appearing in wrong position

Add a weight to the form ID entry (e.g., form_id|50). Higher weights push the element lower in the form. Note that weights don't work for Webforms due to their architecture.

Translations not working

Enable the Configuration Translation module. Go to /admin/config/regional/config-translation and look for FZ152 entries to translate each configuration for your languages.

Security Notes 2
  • The checkbox label field accepts HTML - ensure only trusted administrators can modify this setting as it could be used for XSS attacks
  • The privacy policy text field uses Drupal's text format system - use an appropriate format that sanitizes content based on who will be editing