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,
|
||||
array(
|
||||
'show_in_rest' => array(
|
||||
'schema' => ( new Email_Styles_Schema() )->getSchema(),
|
||||
'schema' => ( new Email_Styles_Schema() )->get_schema(),
|
||||
),
|
||||
'single' => true,
|
||||
'type' => 'object',
|
||||
@@ -204,7 +204,7 @@ class Templates {
|
||||
'update_callback' => function ( $value, $template ) {
|
||||
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 {
|
||||
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 {
|
||||
|
@@ -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;
|
||||
|
||||
use MailPoet\EmailEditor\Validator\Builder;
|
||||
|
||||
/**
|
||||
* Class for 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(
|
||||
'fontFamily' => Builder::string()->nullable(),
|
||||
'fontSize' => Builder::string()->nullable(),
|
||||
@@ -42,52 +56,52 @@ class Email_Styles_Schema {
|
||||
'text' => Builder::string()->nullable(),
|
||||
)
|
||||
)->nullable(),
|
||||
'typography' => $typographyProps,
|
||||
'typography' => $typography_props,
|
||||
'elements' => Builder::object(
|
||||
array(
|
||||
'heading' => Builder::object(
|
||||
array(
|
||||
'typography' => $typographyProps,
|
||||
'typography' => $typography_props,
|
||||
)
|
||||
)->nullable(),
|
||||
'button' => Builder::object(
|
||||
array(
|
||||
'typography' => $typographyProps,
|
||||
'typography' => $typography_props,
|
||||
)
|
||||
)->nullable(),
|
||||
'link' => Builder::object(
|
||||
array(
|
||||
'typography' => $typographyProps,
|
||||
'typography' => $typography_props,
|
||||
)
|
||||
)->nullable(),
|
||||
'h1' => Builder::object(
|
||||
array(
|
||||
'typography' => $typographyProps,
|
||||
'typography' => $typography_props,
|
||||
)
|
||||
)->nullable(),
|
||||
'h2' => Builder::object(
|
||||
array(
|
||||
'typography' => $typographyProps,
|
||||
'typography' => $typography_props,
|
||||
)
|
||||
)->nullable(),
|
||||
'h3' => Builder::object(
|
||||
array(
|
||||
'typography' => $typographyProps,
|
||||
'typography' => $typography_props,
|
||||
)
|
||||
)->nullable(),
|
||||
'h4' => Builder::object(
|
||||
array(
|
||||
'typography' => $typographyProps,
|
||||
'typography' => $typography_props,
|
||||
)
|
||||
)->nullable(),
|
||||
'h5' => Builder::object(
|
||||
array(
|
||||
'typography' => $typographyProps,
|
||||
'typography' => $typography_props,
|
||||
)
|
||||
)->nullable(),
|
||||
'h6' => Builder::object(
|
||||
array(
|
||||
'typography' => $typographyProps,
|
||||
'typography' => $typography_props,
|
||||
)
|
||||
)->nullable(),
|
||||
)
|
||||
|
Reference in New Issue
Block a user