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