pm4life/cmsinstaller

Magento 2 utility module for migrating/managing cms pages and block data from local environment to remote

Installs: 10

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 2

Forks: 0

Open Issues: 0

Type:magento2-module

1.0.1 2023-01-15 15:00 UTC

This package is auto-updated.

Last update: 2025-06-15 20:21:02 UTC


README

Why? Because why not.

Usually when developing new or maintaining project there is a need for managing cms content. This extension provides an option to export cms content to a .html which can be added to project repository and moved easily from local to development or production environment. At least that's the general idea, could be totally wrong here, who knows, who cares.

Installation:

Download package from git or install it via composer with:

composer require pm4life/cmsinstaller
php bin/magento setup:upgrade

Next, enable module either via console command:

php bin/magento config:set cms/installer/is_enabled 1

or by settings in admin: Admin > Stores > Configuration > General > Content Management > Cms Content Installer

Screenshot from 2022-05-03 10-03-20

Configuration

There are two options for cms templates, they can either be placed within app/design/frontend/cms_install directory, or within certain allowed modules, this is controlled by admin setting, by default when extension is installed it is set to use app/design/frontend/cms_install directory as template base.

By switching Install Template Base to Allowed Module(s) Directory you have option to select any enabled module from app/code space

Screenshot from 2022-05-03 10-10-19

The idea is to present options for developer to choose if for any reason it is more convenient to have them placed all at one location per project, or alternatively have templates separated per module within local space.

Usage

Template preparation and export

After editing on cms page or block is completed in local environment, these can be exported to make them available for moving from environment.

To create template exports there are two ways, first one with console command:

php bin/magento cms:installer:export --type block --identifier 'catalog_events_lister,new_block_file'

Where two parameters are passed --type represents type of entity that is being exported, and --identifier represents unique identifiers of given page/cms block.

If command is called without parameters it will export all available cms blocks and pages.

Besides this way, when application is in developer or default mode, a button is available in admin panel on cms page and block forms, which generates template export that can be placed in apropriate filesystem location depending on configuration settings from above.

Screenshot from 2022-05-03 10-45-12

Installing changes from templates to system

To apply changes from template files on remote environment run:

php bin/magento cms:installer:apply

Changes to template files are tracked, so if you add changes to template file and run cms:installer:apply command, that will result in given block or page being updated with those changes.

Additional features

You can also use this console command to run regeneration of all active cms page url rewrites Please take into account any customizations that you have on your store as this is not something that should be done on a regular basis.

php bin/magento cms:installer:rebuild-url-rewrites