Register send status

[MAILPOET-5851]
This commit is contained in:
Pavel Dohnal
2024-02-14 14:12:22 +01:00
committed by Aschepikov
parent e9d8610cda
commit 9cf2eef721

View File

@@ -2,6 +2,8 @@
namespace MailPoet\EmailEditor\Engine;
use MailPoet\Entities\NewsletterEntity;
/**
* @phpstan-type EmailPostType array{name: string, args: array}
* See register_post_type for details about EmailPostType args.
@@ -19,6 +21,7 @@ class EmailEditor {
public function initialize(): void {
do_action('mailpoet_email_editor_initialized');
$this->registerEmailPostTypes();
$this->registerEmailPostSendStatus();
$this->extendEmailPostApi();
}
@@ -56,6 +59,17 @@ class EmailEditor {
];
}
private function registerEmailPostSendStatus(): void {
register_post_status( NewsletterEntity::STATUS_SENT, [
'public' => false,
'exclude_from_search' => true,
'internal' => true, // for now, we hide it, if we use the status in the listings we may flip this and following values
'show_in_admin_all_list' => false,
'show_in_admin_status_list' => false,
]
);
}
public function extendEmailPostApi() {
$emailPostTypes = array_column($this->getPostTypes(), 'name');
register_rest_field($emailPostTypes, 'email_data', [