geno/wp-content/plugins/mailpoet/lib/EmailEditor/Engine/EmailApiController.php
2024-02-01 11:54:18 +00:00

50 lines
1.2 KiB
PHP

<?php declare(strict_types = 1);
namespace MailPoet\EmailEditor\Engine;
if (!defined('ABSPATH')) exit;
use MailPoet\Validator\Builder;
class EmailApiController {
/** @var SettingsController */
private $settingsController;
public function __construct(
SettingsController $settingsController
) {
$this->settingsController = $settingsController;
}
/**
* @return array - Email specific data such styles.
*/
public function getEmailData(): array {
return [
'layout_styles' => $this->settingsController->getEmailLayoutStyles(),
];
}
/**
* Update Email specific data we store.
*/
public function saveEmailData(array $data, \WP_Post $emailPost): void {
// Here comes code saving of Email specific data that will be passed on 'email_data' attribute
}
public function getEmailDataSchema(): array {
return Builder::object([
'layout_styles' => Builder::object([
'width' => Builder::string(),
'background' => Builder::string(),
'padding' => Builder::object([
'bottom' => Builder::string(),
'left' => Builder::string(),
'right' => Builder::string(),
'top' => Builder::string(),
]),
]),
])->toArray();
}
}