From 6eca06780f9adc7afcf865e493b9f4abda96fcac Mon Sep 17 00:00:00 2001 From: Rostislav Wolny Date: Mon, 16 Dec 2024 14:50:08 +0100 Subject: [PATCH] Add action for registering email templates This commit introduces a new action to trigger registering email templates. We need a custom action for that because the email editor engine controls when we register templates and when we don't. Currently, we still skip registering templates when we detect the site editor page. [MAILPOET-6356] --- packages/php/email-editor/README.md | 9 +++++---- .../src/Engine/Templates/class-templates.php | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/php/email-editor/README.md b/packages/php/email-editor/README.md index f91958fb6e..9d60f38dfc 100644 --- a/packages/php/email-editor/README.md +++ b/packages/php/email-editor/README.md @@ -56,10 +56,11 @@ We may add, update and delete any of them. ### Actions -| Name | Argument | Description | -|----------------------------------------|------------------|----------------------------------------------------------------------------------------------------| -| `mailpoet_email_editor_initialized` | `null` | Called when the Email Editor is initialized | -| `mailpoet_blocks_renderer_initialized` | `BlocksRegistry` | Called when the block content renderer is initialized. You may use this to add a new BlockRenderer | +| Name | Argument | Description | +|--------------------------------------------|------------------|------------------------------------------------------------------------------------------------------------------| +| `mailpoet_email_editor_initialized` | `null` | Called when the Email Editor is initialized | +| `mailpoet_blocks_renderer_initialized` | `BlocksRegistry` | Called when the block content renderer is initialized. You may use this to add a new BlockRenderer | +| `mailpoet_email_editor_register_templates` | | Called when the basic blank email template is registered. You can add more templates via register_block_template | ### Filters diff --git a/packages/php/email-editor/src/Engine/Templates/class-templates.php b/packages/php/email-editor/src/Engine/Templates/class-templates.php index c3c9d0e7a8..9411ff3c0a 100644 --- a/packages/php/email-editor/src/Engine/Templates/class-templates.php +++ b/packages/php/email-editor/src/Engine/Templates/class-templates.php @@ -90,6 +90,7 @@ class Templates { ) ); } + do_action( 'mailpoet_email_editor_register_templates' ); } /**