fom/module-setup-fixtures-cms

CMS page and block adapter for the FriendsOfMagento setup-fixtures engine.

Maintainers

Package info

github.com/FriendsOfMagento/module-setup-fixtures-cms

Type:magento2-module

pkg:composer/fom/module-setup-fixtures-cms

Transparency log

Statistics

Installs: 14

Dependents: 3

Suggesters: 1

Stars: 0

Open Issues: 0

1.0.0 2026-08-23 16:52 UTC

This package is auto-updated.

Last update: 2026-08-23 20:06:45 UTC


README

CMS page and block adapter for the SetupFixtures engine.

This module teaches the generic fixture engine how to create and update Magento CMS pages and blocks from version-controlled JSON + HTML fixtures. You keep CMS content in code, and it is applied idempotently on every bin/magento setup:upgrade - only fields that actually changed are re-applied, and manual admin edits to untouched fields are preserved.

It ships no fixtures of its own. A consumer module (for example Fom_SetupFixturesCmsData) provides the fixture files and registers them.

Features

  • CMS page fixtures with 15 managed fields (title, content, layout, meta, theming, active status, store assignment).
  • CMS block fixtures with 4 managed fields.
  • HTML content kept in sibling .html files, not inline JSON.
  • Multi-store assignment with all / specific modes; store-scoped identity so the same identifier can exist independently per store set.
  • Create-vs-update decided by matching identifier and exact store assignment.
  • All the engine guarantees: per-field hashing, admin-safe updates, validation, CLI tooling.

Supported versions

Magento 2

Magento 2.4.4–2.4.6 and PHP 8.1 are not supported.

Magento PHP
2.4.7 8.2, 8.3
2.4.8 8.3, 8.4
2.4.9 8.5

The package declares only direct dependencies and uses bounded component API families; the consuming Magento metapackage selects the exact security patch. Recheck the Adobe system requirements when maintaining this table.

Mage-OS

Mage-OS PHP Magento base
3.4.0 8.3, 8.4, 8.5 2.4.9

Mage-OS 3.4 replaces the Magento 2.4.9 framework and CMS component packages, so the existing direct dependency constraints support both distributions. See the Mage-OS release policy and system requirements.

Installation

composer require fom/module-setup-fixtures-cms
bin/magento module:enable Fom_SetupFixturesCms
bin/magento setup:upgrade

This pulls in the core engine (fom/module-setup-fixtures) automatically.

Dependencies

Module sequence (etc/module.xml): Magento_Cms, Fom_SetupFixtures.

Basic usage

A consumer module ships a JSON/HTML pair and registers the JSON file ID on the page or block installer.

fixtures/cms/page/home.json:

{
  "identifier": "home",
  "title": "Home Page",
  "page_layout": "cms-full-width",
  "is_active": true,
  "stores": { "mode": "all" },
  "meta_title": "Home Page",
  "content_file": "home.html"
}

fixtures/cms/page/home.html:

<div class="cms-home">
    <h1>Welcome to Our Store</h1>
    <p>Discover our latest products and exclusive offers.</p>
</div>

etc/di.xml:

<virtualType name="Fom\SetupFixturesCms\Model\Page\Installer\Virtual">
    <arguments>
        <argument name="fixtureFiles" xsi:type="array">
            <item name="home" xsi:type="string">Acme_Content::fixtures/cms/page/home.json</item>
        </argument>
    </arguments>
</virtualType>

Then bin/magento setup:upgrade. For blocks, register on Fom\SetupFixturesCms\Model\Block\Installer\Virtual.

Documentation

Supported entities & fields (summary)

Entity Installer entity type Managed fields
CMS Page cms_page title, content_heading, content, page_layout, layout_update_xml, custom_theme, custom_root_template, custom_layout_update_xml, custom_theme_from, custom_theme_to, meta_title, meta_keywords, meta_description, is_active, stores
CMS Block cms_block title, content, is_active, stores

identifier is identity, not a managed field. See CMS Pages and CMS Blocks for the authoritative per-field tables.

Related modules

  • SetupFixtures - the engine this module adapts; read it to understand hashing, state, and the CLI.
  • SetupFixturesCmsHyvaTailwindJit
    • extends these CMS fixtures with Hyvä Tailwind JIT fields and per-theme CSS persistence.
  • SetupFixtures Suite - metapackage bundling the engine and standard adapters. The Hyvä extension remains optional.

License

Licensed under the Open Software License 3.0 (OSL-3.0).