PluginProbe
YayMail – WooCommerce Email Customizer / trunk
YayMail – WooCommerce Email Customizer vtrunk
4.4.4 4.4.3 4.4.2 4.4.1 trunk 1.9.6 2.1.4 2.1.5 3.2.2 3.2.6 3.2.7.1 3.2.8.1 3.2.9 3.3 3.3.1 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9 3.4 3.4.1 3.4.2 3.4.3 All 55 releases
yaymail / src / Elements / FeaturedPosts.php

FeaturedPosts.php in YayMail – WooCommerce Email Customizer trunk, at src/Elements/FeaturedPosts.php

316 lines 22.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace YayMail\Elements;
3
4 use YayMail\Abstracts\BaseElement;
5 use YayMail\Utils\SingletonTrait;
6
7 /**
8 * Featured Posts Element
9 */
10 class FeaturedPosts extends BaseElement {
11
12 use SingletonTrait;
13
14 protected static $type = 'featured_posts';
15
16 public $available_email_ids = [];
17
18 public static function get_data( $attributes = [] ) {
19 self::$icon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
20 <path d="M4,2.5h12c.83,0,1.5.67,1.5,1.5v12c0,.83-.67,1.5-1.5,1.5H4c-.83,0-1.5-.67-1.5-1.5V4c0-.83.67-1.5,1.5-1.5ZM5,5v10h10V5H5ZM7,7h6v1.5H7V7Zm0,3h6v1.5H7v-1.5Zm0,3h4v1.5H7v-1.5Z"/>
21 </svg>';
22
23 $button_conditions = [
24 [
25 'comparison' => 'contain',
26 'value' => [ 'button' ],
27 'attribute' => 'showing_items',
28 ],
29 ];
30
31 return [
32 'id' => uniqid(),
33 'type' => self::$type,
34 'name' => __( 'Featured Posts', 'yaymail' ),
35 'icon' => self::$icon,
36 'group' => 'block',
37 'tags' => [ 'wordpress' ],
38 'available' => false,
39 'disabled_reason' => [
40 'html' => '<svg id="yaymail-featured_products" class="yaymail-element-disabled-icon" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 428 300"><defs><style> #yaymail-featured_products .st0 { fill: #fff; } #yaymail-featured_products .st1 { fill: #edeff3; } #yaymail-featured_products .st2 { fill: none; } #yaymail-featured_products .st3 { fill: #1f2937; } #yaymail-featured_products .st4 { fill: #dee2e9; } #yaymail-featured_products .st5 { fill: #c9ced6; } </style></defs><g id="Layer_1-2"><g><rect class="st0" width="428" height="300"/><g><path class="st3" d="M101.3,31.8h12.7v2.9h-9.2v5.1h8.7v2.9h-8.7v7.8h-3.4v-18.7h0Z"/><path class="st3" d="M119.1,44.2c0,2.1,1.1,3.9,3.1,3.9s2.3-.8,2.7-1.7h3.4c-.5,1.7-2,4.4-6.2,4.4s-6.4-3.5-6.4-7.1,2.2-7.5,6.6-7.5,6.2,3.5,6.2,6.8,0,.8,0,1.2h-9.4,0ZM125.1,42.1c0-1.8-.8-3.4-2.9-3.4s-2.9,1.4-3.1,3.4h6Z"/><path class="st3" d="M142.4,47.1c0,1.3.1,3,.2,3.4h-3.2c-.1-.3-.2-1-.2-1.5-.5.8-1.5,1.8-4,1.8s-4.7-2.2-4.7-4.3c0-3.1,2.5-4.6,6.6-4.6h2.1v-1c0-1.1-.4-2.2-2.4-2.2s-2.2.8-2.4,1.9h-3.2c.2-2.3,1.6-4.3,5.8-4.3,3.6,0,5.6,1.5,5.6,4.7v6.1h0ZM139.1,44h-1.8c-2.5,0-3.5.7-3.5,2.3s.7,2.1,2.2,2.1c2.7,0,3.1-1.9,3.1-4v-.4Z"/><path class="st3" d="M144.3,36.6h2.2v-3.9h3.4v3.9h2.8v2.6h-2.8v7.3c0,1.2.3,1.7,1.5,1.7s.7,0,1,0v2.4c-.7.2-1.7.3-2.4.3-2.5,0-3.4-1.3-3.4-3.7v-7.8h-2.2v-2.6h0Z"/><path class="st3" d="M166.8,46.5c0,1.3,0,2.9,0,4h-3.3c0-.4,0-1.2-.1-1.8-.8,1.4-2,2.1-3.9,2.1s-4.6-1.5-4.6-5.1v-9.1h3.4v8.4c0,1.6.5,3,2.4,3s2.8-1.1,2.8-4.1v-7.3h3.4v9.8h0Z"/><path class="st3" d="M170.4,40.4c0-1.6,0-2.8,0-3.8h3.3c0,.3,0,1.6,0,2.6.6-1.7,2.2-2.9,4.5-2.9v3.2c-2.8,0-4.5,1-4.5,4.7v6.3h-3.4v-10.1h0Z"/><path class="st3" d="M183,44.2c0,2.1,1.1,3.9,3.1,3.9s2.3-.8,2.7-1.7h3.4c-.5,1.7-2,4.4-6.2,4.4s-6.4-3.5-6.4-7.1,2.2-7.5,6.6-7.5,6.2,3.5,6.2,6.8,0,.8,0,1.2h-9.4,0ZM189,42.1c0-1.8-.8-3.4-2.9-3.4s-2.9,1.4-3.1,3.4h6Z"/><path class="st3" d="M207.7,30.7v15.9c0,1.3,0,2.6,0,3.8h-3.2c0-.4-.1-1.2-.2-1.6-.7,1.2-1.9,2-4.1,2-3.5,0-5.8-2.8-5.8-7.1s2.4-7.4,6.3-7.4,3.2.8,3.6,1.5v-7s3.4,0,3.4,0ZM197.9,43.6c0,2.9,1.2,4.5,3.2,4.5,2.8,0,3.3-2.3,3.3-4.6s-.4-4.5-3.2-4.5-3.4,1.7-3.4,4.6h0Z"/><path class="st3" d="M218.4,31.8h7.5c3.9,0,6.5,2.2,6.5,5.7s-2.9,5.8-6.6,5.8h-3.9v7.2h-3.5v-18.7h0ZM221.9,40.5h3.5c2.1,0,3.4-.9,3.4-2.9s-1.4-2.9-3.3-2.9h-3.6v5.8h0Z"/><path class="st3" d="M234.9,40.4c0-1.6,0-2.8,0-3.8h3.3c0,.3,0,1.6,0,2.6.6-1.7,2.2-2.9,4.5-2.9v3.2c-2.8,0-4.5,1-4.5,4.7v6.3h-3.4v-10.1h0Z"/><path class="st3" d="M257.5,43.5c0,4.1-2.4,7.3-6.8,7.3s-6.7-3.1-6.7-7.2,2.5-7.3,6.8-7.3,6.6,2.9,6.6,7.2ZM247.5,43.5c0,2.8,1.3,4.6,3.3,4.6s3.3-1.8,3.3-4.6-1.2-4.6-3.3-4.6-3.3,1.6-3.3,4.6Z"/><path class="st3" d="M272.8,30.7v15.9c0,1.3,0,2.6,0,3.8h-3.2c0-.4-.1-1.2-.2-1.6-.7,1.2-1.9,2-4.1,2-3.5,0-5.8-2.8-5.8-7.1s2.4-7.4,6.3-7.4,3.2.8,3.6,1.5v-7h3.4ZM263.1,43.6c0,2.9,1.2,4.5,3.2,4.5,2.8,0,3.3-2.3,3.3-4.6s-.4-4.5-3.2-4.5-3.4,1.7-3.4,4.6Z"/><path class="st3" d="M288.3,46.5c0,1.3,0,2.9,0,4h-3.3c0-.4,0-1.2-.1-1.8-.8,1.4-2,2.1-4,2.1s-4.6-1.5-4.6-5.1v-9.1h3.4v8.4c0,1.6.5,3,2.4,3s2.8-1.1,2.8-4.1v-7.3h3.4v9.8h0Z"/><path class="st3" d="M303.7,46.1c-.5,2.3-2.1,4.7-6.1,4.7s-6.4-2.9-6.4-7.2,2.4-7.3,6.6-7.3,5.8,3.2,5.9,4.8h-3.3c-.3-1.2-1-2.2-2.7-2.2s-3.1,1.7-3.1,4.6,1.1,4.6,3.1,4.6,2.3-.8,2.7-2.1h3.3Z"/><path class="st3" d="M305,36.6h2.2v-3.9h3.4v3.9h2.8v2.6h-2.8v7.3c0,1.2.3,1.7,1.5,1.7s.7,0,1,0v2.4c-.7.2-1.7.3-2.4.3-2.5,0-3.4-1.3-3.4-3.7v-7.8h-2.2v-2.6h0Z"/><path class="st3" d="M318.2,46.4c.3,1.2,1.3,2,2.9,2s2.2-.6,2.2-1.6-.6-1.5-2.8-2c-4.3-1.1-5.1-2.4-5.1-4.3s1.4-4.1,5.4-4.1,5.4,2.2,5.6,4.1h-3.2c-.1-.6-.6-1.7-2.5-1.7s-2,.7-2,1.4.5,1.2,2.8,1.8c4.5,1,5.2,2.6,5.2,4.6s-1.8,4.3-5.8,4.3-5.8-2-6.1-4.4h3.3,0Z"/></g><rect class="st4" x="76.1" y="75.1" width="275.8" height="13.6" rx="6.8" ry="6.8"/><g><path class="st1" d="M41,197.3h80.7c2.6,0,4.8,2.1,4.8,4.8h0c0,2.6-2.1,4.8-4.8,4.8H41c-2.6,0-4.8-2.1-4.8-4.8h0c0-2.6,2.1-4.8,4.8-4.8Z"/><path class="st1" d="M52.2,215.9h58.2c2.6,0,4.8,2.1,4.8,4.8h0c0,2.6-2.1,4.8-4.8,4.8h-58.2c-2.6,0-4.8-2.1-4.8-4.8h0c0-2.6,2.1-4.8,4.8-4.8Z"/></g><rect class="st1" x="31.5" y="108.1" width="99.7" height="76" rx="7" ry="7"/><g><rect class="st4" x="43.4" y="240.1" width="75.9" height="28.1" rx="4" ry="4"/><path class="st2" d="M85,258.8c.9,0,1.7.8,1.7,1.7s-.8,1.7-1.7,1.7-1.7-.8-1.7-1.7.8-1.7,1.7-1.7ZM78.1,258.8c.9,0,1.7.8,1.7,1.7s-.8,1.7-1.7,1.7-1.7-.8-1.7-1.7.8-1.7,1.7-1.7ZM89.5,250c-.3-.5-.9-.8-1.4-.8h-10.9v-2.2c0-.5-.4-.9-.9-.9h-2.6c-.5,0-.9.4-.9.9s.4.9.9.9h1.7v3.5h0v4.4c0,1,.8,1.7,1.7,1.7h9c.7,0,1.3-.4,1.6-1.1l1.9-4.8c.2-.5.2-1.1-.2-1.6h0Z"/></g><g><path class="st1" d="M173.4,197.3h80.7c2.6,0,4.8,2.1,4.8,4.8h0c0,2.6-2.1,4.8-4.8,4.8h-80.7c-2.6,0-4.8-2.1-4.8-4.8h0c0-2.6,2.1-4.8,4.8-4.8Z"/><path class="st1" d="M184.6,215.9h58.2c2.6,0,4.8,2.1,4.8,4.8h0c0,2.6-2.1,4.8-4.8,4.8h-58.2c-2.6,0-4.8-2.1-4.8-4.8h0c0-2.6,2.1-4.8,4.8-4.8Z"/></g><rect class="st1" x="163.9" y="108.1" width="99.7" height="76" rx="7" ry="7"/><g><rect class="st4" x="175.8" y="240.1" width="75.9" height="28.1" rx="4" ry="4"/><path class="st2" d="M217.4,258.8c.9,0,1.7.8,1.7,1.7s-.8,1.7-1.7,1.7-1.7-.8-1.7-1.7.8-1.7,1.7-1.7ZM210.5,258.8c.9,0,1.7.8,1.7,1.7s-.8,1.7-1.7,1.7-1.7-.8-1.7-1.7.8-1.7,1.7-1.7ZM221.9,250c-.3-.5-.9-.8-1.4-.8h-10.9v-2.2c0-.5-.4-.9-.9-.9h-2.6c-.5,0-.9.4-.9.9s.4.9.9.9h1.7v3.5h0v4.4c0,1,.8,1.7,1.7,1.7h9c.7,0,1.4-.4,1.6-1.1l1.9-4.8c.2-.5.1-1.1-.2-1.6h0Z"/></g><g><path class="st1" d="M306.3,197.3h80.7c2.6,0,4.8,2.1,4.8,4.8h0c0,2.6-2.1,4.8-4.8,4.8h-80.7c-2.6,0-4.8-2.1-4.8-4.8h0c0-2.6,2.1-4.8,4.8-4.8Z"/><path class="st1" d="M317.6,215.9h58.2c2.6,0,4.8,2.1,4.8,4.8h0c0,2.6-2.1,4.8-4.8,4.8h-58.2c-2.6,0-4.8-2.1-4.8-4.8h0c0-2.6,2.1-4.8,4.8-4.8Z"/></g><rect class="st1" x="296.8" y="108.1" width="99.7" height="76" rx="7" ry="7"/><g><rect class="st4" x="308.7" y="240.1" width="75.9" height="28.1" rx="4" ry="4"/><path class="st2" d="M350.4,258.8c.9,0,1.7.8,1.7,1.7s-.8,1.7-1.7,1.7-1.7-.8-1.7-1.7.8-1.7,1.7-1.7ZM343.4,258.8c.9,0,1.7.8,1.7,1.7s-.8,1.7-1.7,1.7-1.7-.8-1.7-1.7.8-1.7,1.7-1.7ZM354.9,250c-.3-.5-.9-.8-1.4-.8h-10.9v-2.2c0-.5-.4-.9-.9-.9h-2.6c-.5,0-.9.4-.9.9s.4.9.9.9h1.7v3.5h0v4.4c0,1,.8,1.7,1.7,1.7h9c.7,0,1.4-.4,1.6-1.1l1.9-4.8c.2-.5.1-1.1-.2-1.6h0Z"/></g><path class="st5" d="M73.2,139.5c-2.8,0-5.1-2.4-5.1-5.2,0-2.8,2.4-5.1,5.2-5.1,2.8,0,5.2,2.4,5.1,5.2,0,2.8-2.4,5.1-5.2,5.1ZM104.2,162.9c-7.6,0-15.2,0-22.9,0h-23.6c-.7,0-1.5,0-1.8-.7-.4-.7,0-1.4.4-2,3-4.2,6-8.4,9.1-12.5,1.3-1.8,2.9-1.7,4.3,0,.8,1.1,1.6,2.2,2.4,3.3,1.4,1.8,3.2,1.8,4.6,0,.7-.9,1.3-1.7,1.9-2.6,2.5-3.5,5-7,7.6-10.4.8-1.2,1.9-1.5,3.1-1,.6.3,1,.8,1.4,1.4,5.1,7.1,10.3,14.2,15.4,21.3.5.7,1.3,1.5.8,2.5-.5,1.1-1.6.8-2.5.8h0Z"/><path class="st5" d="M205.6,139.5c-2.8,0-5.1-2.4-5.1-5.2,0-2.8,2.4-5.1,5.1-5.1,2.8,0,5.2,2.4,5.1,5.2,0,2.8-2.4,5.1-5.2,5.1ZM236.7,162.9c-7.6,0-15.2,0-22.9,0h-23.6c-.7,0-1.5,0-1.8-.7-.4-.7,0-1.4.4-2,3-4.2,6-8.4,9.1-12.5,1.3-1.8,2.9-1.7,4.3,0,.8,1.1,1.6,2.2,2.4,3.3,1.4,1.8,3.2,1.8,4.6,0,.7-.9,1.3-1.7,1.9-2.6,2.5-3.5,5-7,7.6-10.4.9-1.2,1.9-1.5,3.1-1,.6.3,1,.8,1.4,1.4,5.1,7.1,10.3,14.2,15.4,21.3.5.7,1.3,1.5.8,2.5-.5,1.1-1.6.8-2.5.8h0Z"/><path class="st5" d="M338.5,139.5c-2.8,0-5.1-2.4-5.1-5.2,0-2.8,2.4-5.1,5.1-5.1,2.8,0,5.2,2.4,5.1,5.2,0,2.8-2.4,5.1-5.2,5.1h0ZM369.6,162.9c-7.6,0-15.2,0-22.9,0h-23.6c-.7,0-1.5,0-1.8-.7-.4-.7,0-1.4.4-2,3-4.2,6-8.4,9.1-12.5,1.3-1.8,2.9-1.7,4.3,0,.8,1.1,1.6,2.2,2.4,3.3,1.4,1.8,3.2,1.8,4.6,0,.7-.9,1.3-1.7,1.9-2.6,2.5-3.5,5-7,7.6-10.4.9-1.2,1.9-1.5,3-1,.6.3,1,.8,1.4,1.4,5.1,7.1,10.3,14.2,15.4,21.3.5.7,1.3,1.5.8,2.5-.5,1.1-1.6.8-2.5.8h0Z"/></g></g></svg>'
41 . '<span>'
42 . self::get_pro_upgrade_text()
43 . '</span>',
44 ],
45 'position' => 221,
46 'status_info' => [
47 'text' => __( 'New', 'yaymail' ),
48 ],
49 'data' => [
50 'padding' => [
51 'value_path' => 'padding',
52 'component' => 'Spacing',
53 'title' => __( 'Padding', 'yaymail' ),
54 'default_value' => isset( $attributes['padding'] ) ? $attributes['padding'] : [
55 'top' => '15',
56 'right' => '50',
57 'bottom' => '15',
58 'left' => '50',
59 ],
60 'type' => 'style',
61 ],
62 'background_color' => [
63 'value_path' => 'background_color',
64 'component' => 'Color',
65 'title' => __( 'Background color', 'yaymail' ),
66 'default_value' => isset( $attributes['background_color'] ) ? $attributes['background_color'] : '#fff',
67 'type' => 'style',
68 ],
69 'text_color' => [
70 'value_path' => 'text_color',
71 'component' => 'Color',
72 'title' => __( 'Text color', 'yaymail' ),
73 'default_value' => isset( $attributes['text_color'] ) ? $attributes['text_color'] : YAYMAIL_COLOR_TEXT_DEFAULT,
74 'type' => 'style',
75 ],
76 'font_family' => [
77 'value_path' => 'font_family',
78 'component' => 'FontFamilySelector',
79 'title' => __( 'Font family', 'yaymail' ),
80 'default_value' => isset( $attributes['font_family'] ) ? $attributes['font_family'] : YAYMAIL_DEFAULT_FAMILY,
81 'type' => 'style',
82 ],
83 'content_breaker' => [
84 'component' => 'LineBreaker',
85 ],
86 'content_group_definition' => [
87 'component' => 'GroupDefinition',
88 'title' => __( 'Content', 'yaymail' ),
89 'description' => __( 'Handle block items settings', 'yaymail' ),
90 ],
91 'showing_items' => [
92 'value_path' => 'showing_items',
93 'component' => 'CheckboxGroup',
94 'title' => __( 'Showing items', 'yaymail' ),
95 'default_value' => isset( $attributes['showing_items'] ) ? $attributes['showing_items'] : [ 'top_content', 'post_image', 'post_title', 'post_excerpt', 'post_date', 'post_author', 'button' ],
96 'type' => 'content',
97 'options' => [
98 [
99 'label' => __( 'Top content', 'yaymail' ),
100 'value' => 'top_content',
101 ],
102 [
103 'label' => __( 'Post image', 'yaymail' ),
104 'value' => 'post_image',
105 ],
106 [
107 'label' => __( 'Post title', 'yaymail' ),
108 'value' => 'post_title',
109 ],
110 [
111 'label' => __( 'Post excerpt', 'yaymail' ),
112 'value' => 'post_excerpt',
113 ],
114 [
115 'label' => __( 'Post date', 'yaymail' ),
116 'value' => 'post_date',
117 ],
118 [
119 'label' => __( 'Post author', 'yaymail' ),
120 'value' => 'post_author',
121 ],
122 [
123 'label' => __( 'Button', 'yaymail' ),
124 'value' => 'button',
125 ],
126 ],
127 ],
128 'top_content' => [
129 'value_path' => 'top_content',
130 'component' => 'RichTextEditor',
131 'title' => __( 'Top content', 'yaymail' ),
132 'default_value' => isset( $attributes['top_content'] ) ? $attributes['top_content'] : '<p style="text-align: center;"><span style="font-size: 18px;"><strong>FEATURED POSTS</strong></span></p>
133 <p style="font-size: 14px; text-align: center;">&nbsp;</p>
134 <p style="text-align: center;">Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>',
135 'type' => 'content',
136 'conditions' => [
137 [
138 'comparison' => 'contain',
139 'value' => [ 'top_content' ],
140 'attribute' => 'showing_items',
141 ],
142 ],
143 ],
144 'button_breaker' => [
145 'component' => 'LineBreaker',
146 'conditions' => $button_conditions,
147 ],
148 'button_group_definition' => [
149 'component' => 'GroupDefinition',
150 'title' => __( 'Button', 'yaymail' ),
151 'description' => __( 'Handle button settings', 'yaymail' ),
152 'conditions' => $button_conditions,
153 ],
154 'button_label' => [
155 'value_path' => 'button_label',
156 'component' => 'TextInput',
157 'title' => __( 'Button text', 'yaymail' ),
158 'default_value' => isset( $attributes['button_label'] ) ? $attributes['button_label'] : __( 'READ MORE', 'yaymail' ),
159 'type' => 'content',
160 'conditions' => $button_conditions,
161 ],
162 'button_background_color' => [
163 'value_path' => 'button_background_color',
164 'component' => 'Color',
165 'title' => __( 'Button background color', 'yaymail' ),
166 'default_value' => isset( $attributes['button_background_color'] ) ? $attributes['button_background_color'] : '#ec4770',
167 'type' => 'style',
168 'conditions' => $button_conditions,
169 ],
170 'button_text_color' => [
171 'value_path' => 'button_text_color',
172 'component' => 'Color',
173 'title' => __( 'Button text color', 'yaymail' ),
174 'default_value' => isset( $attributes['button_text_color'] ) ? $attributes['button_text_color'] : '#ffffff',
175 'type' => 'style',
176 'conditions' => $button_conditions,
177 ],
178 'posts_breaker' => [
179 'component' => 'LineBreaker',
180 ],
181 'posts_group_definition' => [
182 'component' => 'GroupDefinition',
183 'title' => __( 'Posts', 'yaymail' ),
184 'description' => __( 'Handle posts settings', 'yaymail' ),
185 ],
186 'posts_per_row' => [
187 'value_path' => 'posts_per_row',
188 'component' => 'NumberInput',
189 'title' => __( 'Posts per row', 'yaymail' ),
190 'default_value' => isset( $attributes['posts_per_row'] ) ? $attributes['posts_per_row'] : '2',
191 'min' => 1,
192 'max' => 3,
193 'type' => 'content',
194 ],
195 'post_type' => [
196 'value_path' => 'post_type',
197 'component' => 'Selector',
198 'title' => __( 'Post type', 'yaymail' ),
199 'default_value' => isset( $attributes['post_type'] ) ? $attributes['post_type'] : 'newest',
200 'type' => 'content',
201 'options' => [
202 [
203 'label' => __( 'Newest', 'yaymail' ),
204 'value' => 'newest',
205 ],
206 [
207 'label' => __( 'Category selections', 'yaymail' ),
208 'value' => 'category_selections',
209 ],
210 [
211 'label' => __( 'Tag selections', 'yaymail' ),
212 'value' => 'tag_selections',
213 ],
214 [
215 'label' => __( 'Post selections', 'yaymail' ),
216 'value' => 'post_selections',
217 ],
218 ],
219 ],
220 'categories' => [
221 'value_path' => 'categories',
222 'component' => 'EntitiesSelector',
223 'title' => __( 'Post categories', 'yaymail' ),
224 'default_value' => isset( $attributes['categories'] ) ? $attributes['categories'] : [],
225 'type' => 'content',
226 'entity_type' => 'post_categories',
227 'conditions' => [
228 [
229 'value' => 'category_selections',
230 'attribute' => 'post_type',
231 ],
232 ],
233 ],
234 'tags' => [
235 'value_path' => 'tags',
236 'component' => 'EntitiesSelector',
237 'title' => __( 'Post tags', 'yaymail' ),
238 'default_value' => isset( $attributes['tags'] ) ? $attributes['tags'] : [],
239 'type' => 'content',
240 'entity_type' => 'post_tags',
241 'conditions' => [
242 [
243 'value' => 'tag_selections',
244 'attribute' => 'post_type',
245 ],
246 ],
247 ],
248 'posts' => [
249 'value_path' => 'posts',
250 'component' => 'EntitiesSelector',
251 'title' => __( 'Posts', 'yaymail' ),
252 'default_value' => isset( $attributes['posts'] ) ? $attributes['posts'] : [],
253 'type' => 'content',
254 'entity_type' => 'posts',
255 'conditions' => [
256 [
257 'value' => 'post_selections',
258 'attribute' => 'post_type',
259 ],
260 ],
261 ],
262 'sorted_by' => [
263 'value_path' => 'sorted_by',
264 'component' => 'Selector',
265 'title' => __( 'Sorted by', 'yaymail' ),
266 'default_value' => isset( $attributes['sorted_by'] ) ? $attributes['sorted_by'] : 'none',
267 'options' => [
268 [
269 'label' => __( 'None', 'yaymail' ),
270 'value' => 'none',
271 ],
272 [
273 'label' => __( 'Name A-Z', 'yaymail' ),
274 'value' => 'name_a_z',
275 ],
276 [
277 'label' => __( 'Name Z-A', 'yaymail' ),
278 'value' => 'name_z_a',
279 ],
280 [
281 'label' => __( 'Date ascending', 'yaymail' ),
282 'value' => 'date_ascending',
283 ],
284 [
285 'label' => __( 'Date descending', 'yaymail' ),
286 'value' => 'date_descending',
287 ],
288 [
289 'label' => __( 'Random', 'yaymail' ),
290 'value' => 'random',
291 ],
292 ],
293 'type' => 'content',
294 ],
295 'number_of_posts' => [
296 'value_path' => 'number_of_posts',
297 'component' => 'NumberInput',
298 'title' => __( 'Number of featured posts', 'yaymail' ),
299 'default_value' => isset( $attributes['number_of_posts'] ) ? $attributes['number_of_posts'] : '4',
300 'type' => 'content',
301 'min' => 1,
302 'max' => 20,
303 'is_debounce' => true,
304 'conditions' => [
305 [
306 'comparison' => '!=',
307 'value' => 'post_selections',
308 'attribute' => 'post_type',
309 ],
310 ],
311 ],
312 ],
313 ];
314 }
315 }
316