Apply layout styles defined in StylesController and also to editor
[MAILPOET-5540]
This commit is contained in:
committed by
Jan Lysý
parent
fd96b4afad
commit
46d8cb38a0
41
mailpoet/lib/EmailEditor/Engine/EmailApiController.php
Normal file
41
mailpoet/lib/EmailEditor/Engine/EmailApiController.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace MailPoet\EmailEditor\Engine;
|
||||
|
||||
use MailPoet\Validator\Builder;
|
||||
|
||||
class EmailApiController {
|
||||
/** @var StylesController */
|
||||
private $stylesController;
|
||||
|
||||
public function __construct(
|
||||
StylesController $stylesController
|
||||
) {
|
||||
$this->stylesController = $stylesController;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array - Email specific data such styles.
|
||||
*/
|
||||
public function getEmailData(): array {
|
||||
return [
|
||||
'layout_styles' => $this->stylesController->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::integer(),
|
||||
'background' => Builder::string(),
|
||||
]),
|
||||
])->toArray();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user