Search by

infrangible / m2-cms-form-key

infrangible

Adds a widget that inserts the security form key into hand-built forms in CMS pages and blocks, so these forms can post to Magento.

Package info

github.com/infrangible-dev/m2-cms-form-key

Homepage

Type:magento2-module

pkg:composer/infrangible/m2-cms-form-key

Statistics

Installs: 156

Dependents: 0

Suggesters: 0

Stars: 1

Open Issues: 0

2.0.0 2026-11-29 11:26 UTC

This package is auto-updated.

Last update: 2026-11-29 11:28:32 UTC


README

Adds a widget that inserts Magento's form key into forms written directly into CMS pages and blocks, so that Magento accepts their submissions.

Behavior

Magento rejects storefront form submissions without a valid form key, a security token against forged requests. Forms that are written by hand into the content of a CMS page or block cannot contain this key. The widget "CMS Form Key" outputs the same hidden field that Magento's own forms use:

<input name="form_key" type="hidden" value="..." />
  • Insert the widget with "Insert Widget" in the editor of a CMS page or block, between the opening and closing tag of the form. The widget has no options.
  • Pages with the widget stay in the full page cache. Like on all cached pages, Magento's storefront script replaces the cached key with the key of the visitor when the page loads (Luma and other themes based on Magento's blank theme; Hyvä does the same for all form key fields).
  • There are no settings. The form itself, with its target address and fields, is written in the CMS content.

Requirements

  • Magento Open Source or Adobe Commerce 2.4.6 or newer
  • PHP 8.1 or newer

Installation

composer require infrangible/m2-cms-form-key
bin/magento module:enable Infrangible_CmsFormKey
bin/magento setup:upgrade

In production mode, also run bin/magento setup:di:compile.

License

Infrangible CMS Form Key is licensed under the MIT License - see the LICENSE file for details.