mage-os / module-page-builder-template-import-export

mage-os/module-page-builder-template-import-export

PageBuilder template import/export module

  • Samuele Martini
  • Davide Lunardon
magento2-module Compatibility: 2.4.7-2.4.9 Code Quality: Fail Tests: N/A Security: Pass MIT

MageOS PageBuilder Templates Import/Export Module for Magento

Enrich PageBuilder adding templates import/export management.


Overview

The PageBuilder Templates Import/Export module allows you to import and export pagebuilder templates through different magento instances.
You can use it exporting zip templates file locally and move to remote instances or pulling directly from a configured dropbox storage.

[image: remote_template_import]
[image: remote_template_import_confirmation]
[image: remote_template_imported]
[image: apply_template]
[image: template_applied]

🚀 Features

Export Template

Once the module is enabled you can export templates through adminhtml ui going to "Content > Elements > Templates" section clicking on the "Actions" column or through cli.
For cli export execute the following command:

php bin/magento mage-os:pagebuilder_template:export

As result of export you will obtain a .zip file containing the template.

Import Template

You can import templates from adminhtml ui always from the "Content > Elements > Templates" section.
At the top of the page you'll se a CTA "Import Template", clicking on it a modal opens with an "Upload button" find the zip file from the search window and select it.
Cli command is also supported for import:

php bin/magento mage-os:pagebuilder_template:import

Remote Template Import

Once you've configured one or more dropbox apps with success you'll be able to see the remote templates stored there inside the "Import Template" modal.
You will be able to filter them and import on you Magento instance clicking on "Import" link on "Action" column.
Remote dropbox repositories are synced with configured in every dropbox app webhooks.
An alignment is done once per day at 0:00 but you can also make a full alignment executing the following cli command:

php bin/magento mage-os:pagebuilder_template:update-remote-list

🔧 Installation

  1. Install it into your Mage-OS/Magento 2 project with composer:

    composer require mage-os/module-page-builder-template-import-export
    
  2. Enable module

    bin/magento setup:upgrade
    
  3. Add consumer to queue consumer list (suggested)

    Update your env.php file adding "pbTemplateImport" to consumers.

     <?php
     return [
     ...
         'queue' => [
             'consumers_wait_for_messages' => 1
         ],
         'cron_consumers_runner' => [
             'cron_run' => true,
             ...
             'consumers' => [
                 ...
                 'pbTemplateImport'
                 ...
             ]
         ]
     ...
     ];
    

⚙️ Configuration

The module provides configuration options under Stores > Configuration > General > Content Management > Pagebuilder template import/export

General Configuration

  • Enable: Enables or disables the module. This setting is configurable on global scope.
  • Sync remote templates by cron: Let you decide to synchronize remote templates by cron (suggested for large sets of templates stored on remote. See point 3 of installation chapter) or directly after configuration save.
  • Dropbox repositories: Allows you to specify the Dropbox apps from which to receive templates.

Dropbox repositories Configuration

To synchronize remote templates stored on a dropbox repository owned by a vendor you need to add a dropbox app.
Follow these instructions:

To synchronize remote templates stored on one of your own dropbox accounts add a dropbox app following these steps:

  • Specify a name
  • Specify the app_key
  • Specify the app_secret (see https://www.dropbox.com/developers/apps and copy them)
  • Click on "Generate and authorize refresh token" and follow the instructions to generate the one-time valid "access code"
  • Paste "access code" inside the input below the "Refresh Token Generator" column and click the button
  • Save the configuration clicking on the main configuration "Save" button
  • If no errors where encountered during the saving process you'll be able to see a refresh token generated on the fifth column of the row you configured previously.

Congratulations! This credentials will be used for each dropbox api call to the related app storage.
This configuration is managed as multi-row so you can add multiple dropbox apps related to different repositories simultaneously.

Dropbox app Creation

In order to connect Magento with dropbox you need to create a dropbox app related to it: https://www.dropbox.com/developers/reference/getting-started
If you're configuring your own dropbox application for your Dropbox Account you must follow these steps:

  1. Select "Scoped Access" on "Choose an API" section
  2. Select "Full Dropbox" on "Choose the type of access you need" section
  3. Add an app name ex: "My Mage-OS Template Storage"

[image: app_connection]
[image: app_connected]

Dropbox app Configuration

The most important thing is setting the right permissions (following permissions are required):

  • files.metadata.read
  • files.content.read

If you are the owner on Dropbox space and you can manage the app directly you can also configure webhooks for realtime notification and sync.
To do so, add your site webhook endpoint inside "Webhook URIs" section as follows:
https://www.mysite.com/pagebuildertemplateie/template_remote/sync

If correct, your Magento instance will be updated realtime for any update on your Dropbox.

If you're not the owner of the Dropbox you must ask for webhook update to the owner.

🤝 Changelog

Please see CHANGELOG for more information on what has changed recently.

📄 License

The MIT License (MIT). Please see License File for more information.

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog
and this project adheres to Semantic Versioning.

1.8.1 - 2026-05-17

Fixed

  • Declare : int return type on CLI commands for compatibility with Magento 2.4.9 and Mage-OS 3.

1.8.0 - 2026-04-21

Fixed

  • PHP 8.4 and PHP 8.5 compatibility.
  • Guard trim() against file_get_contents() returning false in substituteAdminhtmlStaticUrl.
  • Guard scandir() and file_get_contents() false returns in importTemplateChildren.
  • Null-safe access to parse_url() result keys in TemplateManagement::doSecurityScanForTemplate and CmsConverter::substituteSiteUrls.
  • Null-safe explode() offset access in CmsConverter::convert when parsing pagebuilder media tokens.
  • ModuleConfig::getDropboxCredentials() no longer passes non-string values to unserialize() and always returns an array.
  • ModuleConfig::getDropboxAccountCredentialsByAppKey() no longer iterates non-array credentials.
  • ApiKeySerialized::beforeSave() and afterSave() no longer iterate/unserialize non-array/non-string values.
  • Removed invalid return statements from console command constructors (ImportTemplate, UpdateRemoteTemplateList).
  • Replaced erroneous PHPUnit\Util\Exception usage with LocalizedException in the remote import controller.

Updated

  • Widened composer.json PHP constraint to support PHP 8.1 through 8.5.

1.7.0

Updated

  • Add security check on external files imported through template.
  • Replace adminhtml and frontend urls files included through pagebuilder widget preview module or other solutions.

Fixed

  • Fix undefined variable $children in importTemplateChildren when no files match the pattern
  • Add return type hints to SearchResultInterface methods in Grid/Collection

1.6.2

Updated

  • Add "repeatable_" prefixed widget fields management downloading media files during export.

1.6.1

  • Re-add custom ACL for import/export template functionalities fixing issue #7

1.6.0

  • Fix import issue for missing folders on pub/media, fix issues #7, #6, #5, #4, #3

1.5.3

Fixed

  • Fix issue #1 for error generated saving configurations with empty dropbox settings at first install.

1.5.2

Fixed

  • Fix error for template sync for credentials containing refresh_token

1.5.0

Fixed

  • Fix Ui/Ux for credentials config and documentation related to it

1.4.1

Fixed

  • Fix error on config mapping for remote templates async save

1.4.0

Updated

  • Add remote templates synchronization by cron on configuration save

1.1.0

Updated

1.1.0

Updated

1.0.0

Updated

  • Add adminhtml ui management for remote templates import from dropbox

0.2.3

Updated

  • Export template now consider also annidated children cms blocks

0.2.2

Updated

  • Centralize export template to archive file into one single method

0.2.1

Fixed

  • Fixed module composer.json file adding missing version

Updated

  • Export template method grouped inside a main export method specified by service contract

0.2.0

Added

  • First beta release
  • Template management Model and import/export console commands are now available

0.1.0

Added

  • First Commit
Versions
Version Stability QA Status Compatibility Released
1.8.1 stable Fail Magento 2.4.7-2.4.9 Details 2026-05-18 03:47:07
1.8.0 stable Not tested Not yet tested Details 2026-04-29 02:04:10
1.7.1 stable Not tested Not yet tested Details 2026-04-29 01:59:22
1.7.0 stable Not tested Not yet tested Details 2026-04-16 16:06:00
1.6.3 stable Not tested Not yet tested Details 2026-03-12 15:15:54
1.6.2 stable Not tested Not yet tested Details 2025-10-10 06:39:21
1.6.1 stable Not tested Not yet tested Details 2025-10-08 06:29:25
1.6.0 stable Not tested Not yet tested Details 2025-10-04 15:30:30
1.5.3 stable Not tested Not yet tested Details 2025-06-04 09:24:41
1.5.2 stable Not tested Not yet tested Details 2025-03-27 13:03:55
1.5.1 stable Not tested Not yet tested Details 2025-03-27 08:12:38
1.5.0 stable Not tested Not yet tested Details 2025-03-22 19:30:42
1.4.1 stable Not tested Not yet tested Details 2025-03-22 17:56:55
1.4.0 stable Not tested Not yet tested Details 2025-03-22 17:21:52
1.2.1 stable Not tested Not yet tested Details 2025-03-15 07:53:48
1.2.0 stable Not tested Not yet tested Details 2025-03-14 18:41:14
1.1.2 stable Not tested Not yet tested Details 2025-02-18 07:07:16
1.1.1 stable Not tested Not yet tested Details 2025-02-17 08:38:36
1.1.0 stable Not tested Not yet tested Details 2025-02-16 11:49:20
1.0.0 stable Not tested Not yet tested Details 2025-02-12 06:40:07
0.2.3 stable Not tested Not yet tested Details 2024-11-24 09:58:35
0.2.2 stable Not tested Not yet tested Details 2024-11-18 13:17:53

Requires 4

Package Constraint
php ~8.1.0||~8.2.0||~8.3.0||~8.4.0||~8.5.0
magento/module-page-builder *
spatie/dropbox-api ^1.22
ext-zip *

Requires-dev 1

Package Constraint
phpunit/phpunit ^9.5

Compatibility

Each Magento release line is installed on its supported PHP versions, then the module is built (DI compilation + static-content deploy) and its unit and integration suites are run. The matrix shows the lines and PHP versions the module is confirmed to install and run on. Code-quality results further down (phpstan, phpcs, …) are reported separately and never affect compatibility.

Compatibility matrix (Magento × PHP)
Magento PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5
2.4.7 Pass Pass
2.4.8 Pass Pass
2.4.9 Pass Pass

Code Quality

Advisory checks against the module's source. Static analysis runs once across the whole module; PHPStan re-runs per Magento + PHP version because resolvable symbols differ between releases. These NEVER affect the Compatibility badge — a phpcs finding can't make a module incompatible.

Static analysis

Coding standards (phpcs), mess detection (phpmd), copy-pasted code (cpd), PHP cross-version compatibility, composer.json validity. Each runs once for the whole module.

Static analysis results
Tool Status Findings Summary
PHPCS Fail 82 7 errors, 75 warnings (ruleset: Magento2) — 15 auto-fixable with phpcbf
PHPMD Warning 23 23 rule violations (UnusedFormalParameter:7, IfStatementAssignment:4, CyclomaticComplexity:3, UnusedLocalVariable:3, ExcessiveParameterList:2)
Cpd Pass 0
Composer validate Info 1 valid; 1 advisory note (composer validate --strict)

PHPStan

Type-checks the module's PHP against a real Magento install at the configured gate level. Re-runs per Magento and PHP version because resolvable symbols differ between releases. Cell → details modal.

PHPStan results by Magento and PHP version
Magento PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5
2.4.7 32 32
2.4.8 32 32
2.4.9 32 32

Tests

Unit and integration suites, run for each applicable Magento and PHP version. A test failure speaks to the module's behaviour, not its compatibility with a Magento line, so it is reported here separately and never reddens the compatibility matrix.

Unit tests

Unit tests results by Magento and PHP version
Magento PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5
2.4.7 N/A N/A
2.4.8 N/A N/A
2.4.9 N/A N/A

Integration tests

Integration tests results by Magento and PHP version
Magento PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5
2.4.7 N/A N/A
2.4.8 N/A N/A
2.4.9 N/A N/A

Security

Security checks run directly against the module: an audit of its declared dependencies for known vulnerabilities (composer audit) and a scan of its source for malware and web-shell signatures. Each runs once. A malware detection fails the version outright.

Security results
Tool Status Findings Summary
Composer audit Pass 0
Malware scan Pass 0
License
MIT
Authors

More from mage-os

View vendor
Make it pay

Turn an existing module into recurring revenue.

If you already maintain a Magento 2 module on GitHub or GitLab, listing it on Packagento takes about five minutes. We mirror your tags, handle distribution signing, and route paid licenses through Stripe Connect, so you can keep shipping the way you already do.