Migrate email editor email-styles-schema to WP Coding Standard
[MAILPOET-6240]
This commit is contained in:
@@ -187,7 +187,7 @@ class Templates {
|
|||||||
self::MAILPOET_EMAIL_META_THEME_TYPE,
|
self::MAILPOET_EMAIL_META_THEME_TYPE,
|
||||||
array(
|
array(
|
||||||
'show_in_rest' => array(
|
'show_in_rest' => array(
|
||||||
'schema' => ( new Email_Styles_Schema() )->getSchema(),
|
'schema' => ( new Email_Styles_Schema() )->get_schema(),
|
||||||
),
|
),
|
||||||
'single' => true,
|
'single' => true,
|
||||||
'type' => 'object',
|
'type' => 'object',
|
||||||
@@ -204,7 +204,7 @@ class Templates {
|
|||||||
'update_callback' => function ( $value, $template ) {
|
'update_callback' => function ( $value, $template ) {
|
||||||
return update_post_meta( $template->wp_id, self::MAILPOET_EMAIL_META_THEME_TYPE, $value );
|
return update_post_meta( $template->wp_id, self::MAILPOET_EMAIL_META_THEME_TYPE, $value );
|
||||||
},
|
},
|
||||||
'schema' => ( new Email_Styles_Schema() )->getSchema(),
|
'schema' => ( new Email_Styles_Schema() )->get_schema(),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@@ -122,7 +122,7 @@ class Email_Editor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function getEmailThemeDataSchema(): array {
|
public function getEmailThemeDataSchema(): array {
|
||||||
return ( new Email_Styles_Schema() )->getSchema();
|
return ( new Email_Styles_Schema() )->get_schema();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function extendEmailThemeStyles( WP_Theme_JSON $theme, WP_Post $post ): WP_Theme_JSON {
|
public function extendEmailThemeStyles( WP_Theme_JSON $theme, WP_Post $post ): WP_Theme_JSON {
|
||||||
|
@@ -1,12 +1,26 @@
|
|||||||
<?php declare(strict_types = 1);
|
<?php
|
||||||
|
/**
|
||||||
|
* This file is part of the MailPoet plugin.
|
||||||
|
*
|
||||||
|
* @package MailPoet\EmailEditor
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types = 1);
|
||||||
namespace MailPoet\EmailEditor\Engine;
|
namespace MailPoet\EmailEditor\Engine;
|
||||||
|
|
||||||
use MailPoet\EmailEditor\Validator\Builder;
|
use MailPoet\EmailEditor\Validator\Builder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class for email styles schema.
|
||||||
|
*/
|
||||||
class Email_Styles_Schema {
|
class Email_Styles_Schema {
|
||||||
public function getSchema(): array {
|
/**
|
||||||
$typographyProps = Builder::object(
|
* Returns the schema for email styles.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function get_schema(): array {
|
||||||
|
$typography_props = Builder::object(
|
||||||
array(
|
array(
|
||||||
'fontFamily' => Builder::string()->nullable(),
|
'fontFamily' => Builder::string()->nullable(),
|
||||||
'fontSize' => Builder::string()->nullable(),
|
'fontSize' => Builder::string()->nullable(),
|
||||||
@@ -42,52 +56,52 @@ class Email_Styles_Schema {
|
|||||||
'text' => Builder::string()->nullable(),
|
'text' => Builder::string()->nullable(),
|
||||||
)
|
)
|
||||||
)->nullable(),
|
)->nullable(),
|
||||||
'typography' => $typographyProps,
|
'typography' => $typography_props,
|
||||||
'elements' => Builder::object(
|
'elements' => Builder::object(
|
||||||
array(
|
array(
|
||||||
'heading' => Builder::object(
|
'heading' => Builder::object(
|
||||||
array(
|
array(
|
||||||
'typography' => $typographyProps,
|
'typography' => $typography_props,
|
||||||
)
|
)
|
||||||
)->nullable(),
|
)->nullable(),
|
||||||
'button' => Builder::object(
|
'button' => Builder::object(
|
||||||
array(
|
array(
|
||||||
'typography' => $typographyProps,
|
'typography' => $typography_props,
|
||||||
)
|
)
|
||||||
)->nullable(),
|
)->nullable(),
|
||||||
'link' => Builder::object(
|
'link' => Builder::object(
|
||||||
array(
|
array(
|
||||||
'typography' => $typographyProps,
|
'typography' => $typography_props,
|
||||||
)
|
)
|
||||||
)->nullable(),
|
)->nullable(),
|
||||||
'h1' => Builder::object(
|
'h1' => Builder::object(
|
||||||
array(
|
array(
|
||||||
'typography' => $typographyProps,
|
'typography' => $typography_props,
|
||||||
)
|
)
|
||||||
)->nullable(),
|
)->nullable(),
|
||||||
'h2' => Builder::object(
|
'h2' => Builder::object(
|
||||||
array(
|
array(
|
||||||
'typography' => $typographyProps,
|
'typography' => $typography_props,
|
||||||
)
|
)
|
||||||
)->nullable(),
|
)->nullable(),
|
||||||
'h3' => Builder::object(
|
'h3' => Builder::object(
|
||||||
array(
|
array(
|
||||||
'typography' => $typographyProps,
|
'typography' => $typography_props,
|
||||||
)
|
)
|
||||||
)->nullable(),
|
)->nullable(),
|
||||||
'h4' => Builder::object(
|
'h4' => Builder::object(
|
||||||
array(
|
array(
|
||||||
'typography' => $typographyProps,
|
'typography' => $typography_props,
|
||||||
)
|
)
|
||||||
)->nullable(),
|
)->nullable(),
|
||||||
'h5' => Builder::object(
|
'h5' => Builder::object(
|
||||||
array(
|
array(
|
||||||
'typography' => $typographyProps,
|
'typography' => $typography_props,
|
||||||
)
|
)
|
||||||
)->nullable(),
|
)->nullable(),
|
||||||
'h6' => Builder::object(
|
'h6' => Builder::object(
|
||||||
array(
|
array(
|
||||||
'typography' => $typographyProps,
|
'typography' => $typography_props,
|
||||||
)
|
)
|
||||||
)->nullable(),
|
)->nullable(),
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user