Logger
10 months ago
Patterns
10 months ago
PersonalizationTags
7 months ago
Renderer
1 month ago
Templates
2 months ago
class-assets-manager.php
4 months ago
class-dependency-check.php
1 year ago
class-email-api-controller.php
4 months ago
class-email-editor.php
4 months ago
class-email-styles-schema.php
1 year ago
class-personalizer.php
4 months ago
class-send-preview-email.php
3 months ago
class-settings-controller.php
2 months ago
class-site-style-sync-controller.php
2 months ago
class-theme-controller.php
2 months ago
class-user-theme.php
1 year ago
content-editor.css
9 months ago
content-shared.css
10 months ago
theme.json
2 months ago
class-email-styles-schema.php
115 lines
| 1 | <?php |
| 2 | /** |
| 3 | * This file is part of the WooCommerce Email Editor package |
| 4 | * |
| 5 | * @package Automattic\WooCommerce\EmailEditor |
| 6 | */ |
| 7 | |
| 8 | declare(strict_types = 1); |
| 9 | namespace Automattic\WooCommerce\EmailEditor\Engine; |
| 10 | |
| 11 | use Automattic\WooCommerce\EmailEditor\Validator\Builder; |
| 12 | |
| 13 | /** |
| 14 | * Class for email styles schema. |
| 15 | */ |
| 16 | class Email_Styles_Schema { |
| 17 | /** |
| 18 | * Returns the schema for email styles. |
| 19 | * |
| 20 | * @return array |
| 21 | */ |
| 22 | public function get_schema(): array { |
| 23 | $typography_props = Builder::object( |
| 24 | array( |
| 25 | 'fontFamily' => Builder::string()->nullable(), |
| 26 | 'fontSize' => Builder::string()->nullable(), |
| 27 | 'fontStyle' => Builder::string()->nullable(), |
| 28 | 'fontWeight' => Builder::string()->nullable(), |
| 29 | 'letterSpacing' => Builder::string()->nullable(), |
| 30 | 'lineHeight' => Builder::string()->nullable(), |
| 31 | 'textTransform' => Builder::string()->nullable(), |
| 32 | 'textDecoration' => Builder::string()->nullable(), |
| 33 | ) |
| 34 | )->nullable(); |
| 35 | return Builder::object( |
| 36 | array( |
| 37 | 'version' => Builder::integer(), |
| 38 | 'styles' => Builder::object( |
| 39 | array( |
| 40 | 'spacing' => Builder::object( |
| 41 | array( |
| 42 | 'padding' => Builder::object( |
| 43 | array( |
| 44 | 'top' => Builder::string(), |
| 45 | 'right' => Builder::string(), |
| 46 | 'bottom' => Builder::string(), |
| 47 | 'left' => Builder::string(), |
| 48 | ) |
| 49 | )->nullable(), |
| 50 | 'blockGap' => Builder::string()->nullable(), |
| 51 | ) |
| 52 | )->nullable(), |
| 53 | 'color' => Builder::object( |
| 54 | array( |
| 55 | 'background' => Builder::string()->nullable(), |
| 56 | 'text' => Builder::string()->nullable(), |
| 57 | ) |
| 58 | )->nullable(), |
| 59 | 'typography' => $typography_props, |
| 60 | 'elements' => Builder::object( |
| 61 | array( |
| 62 | 'heading' => Builder::object( |
| 63 | array( |
| 64 | 'typography' => $typography_props, |
| 65 | ) |
| 66 | )->nullable(), |
| 67 | 'button' => Builder::object( |
| 68 | array( |
| 69 | 'typography' => $typography_props, |
| 70 | ) |
| 71 | )->nullable(), |
| 72 | 'link' => Builder::object( |
| 73 | array( |
| 74 | 'typography' => $typography_props, |
| 75 | ) |
| 76 | )->nullable(), |
| 77 | 'h1' => Builder::object( |
| 78 | array( |
| 79 | 'typography' => $typography_props, |
| 80 | ) |
| 81 | )->nullable(), |
| 82 | 'h2' => Builder::object( |
| 83 | array( |
| 84 | 'typography' => $typography_props, |
| 85 | ) |
| 86 | )->nullable(), |
| 87 | 'h3' => Builder::object( |
| 88 | array( |
| 89 | 'typography' => $typography_props, |
| 90 | ) |
| 91 | )->nullable(), |
| 92 | 'h4' => Builder::object( |
| 93 | array( |
| 94 | 'typography' => $typography_props, |
| 95 | ) |
| 96 | )->nullable(), |
| 97 | 'h5' => Builder::object( |
| 98 | array( |
| 99 | 'typography' => $typography_props, |
| 100 | ) |
| 101 | )->nullable(), |
| 102 | 'h6' => Builder::object( |
| 103 | array( |
| 104 | 'typography' => $typography_props, |
| 105 | ) |
| 106 | )->nullable(), |
| 107 | ) |
| 108 | )->nullable(), |
| 109 | ) |
| 110 | )->nullable(), |
| 111 | ) |
| 112 | )->to_array(); |
| 113 | } |
| 114 | } |
| 115 |