Skip to content

Commit 7aa8355

Browse files
committed
Merge remote-tracking branch 'trigger/MC-1405' into MC-1405
# Conflicts: # app/code/Magento/PageBuilder/Test/Mftf/Test/AdminPageBuilderAdvancedConfigurationTest.xml
2 parents b1dbfbf + 10bfc3b commit 7aa8355

31 files changed

+237
-204
lines changed

app/code/Magento/PageBuilder/Test/Mftf/Test/AdminPageBuilderAdvancedConfigurationTest.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,9 @@
364364
<testCaseId value="MAGETWO-89332"/>
365365
<group value="pagebuilder"/>
366366
<group value="pagebuilder-advancedConfig"/>
367+
<skip>
368+
<issueId value="MC-3723"/>
369+
</skip>
367370
</annotations>
368371
<before>
369372
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>

app/code/Magento/PageBuilder/Test/Mftf/Test/AdminPageBuilderBlockTest.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
<createData entity="_defaultCmsPage" stepKey="createCMSPage" />
2828
</before>
2929
<after>
30-
<actionGroup ref="DisabledWYSIWYG" stepKey="disableWYSIWYG"/>
3130
<actionGroup ref="logout" stepKey="logout"/>
3231
<deleteData createDataKey="createCMSPage" stepKey="deletePreReqCMSPage" />
3332
</after>

app/code/Magento/PageBuilder/Test/Mftf/Test/AdminPageBuilderCommonTest.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1327,9 +1327,6 @@
13271327
<group value="pagebuilder"/>
13281328
<group value="pagebuilder-common"/>
13291329
<group value="pagebuilder-urlInput"/>
1330-
<skip>
1331-
<issueId value="MC-3720"/>
1332-
</skip>
13331330
</annotations>
13341331
<before>
13351332
<magentoCLI command="config:set general/store_information/country_id US" stepKey="setValueForCountryVariable"/>

app/code/Magento/PageBuilder/Test/Mftf/Test/AdminPageBuilderTextTest.xml

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@
2020
<group value="pagebuilder"/>
2121
<group value="pagebuilder-text"/>
2222
<group value="pagebuilder-tabs-content"/>
23-
<skip>
24-
<issueId value="MC-3720"/>
25-
</skip>
2623
</annotations>
2724
<before>
2825
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
@@ -147,9 +144,6 @@
147144
<testCaseId value="MC-3464"/>
148145
<group value="pagebuilder"/>
149146
<group value="pagebuilder-text"/>
150-
<skip>
151-
<issueId value="MC-3720"/>
152-
</skip>
153147
</annotations>
154148
<before>
155149
<createData entity="_defaultCmsPage" stepKey="createCMSPage" />
@@ -190,9 +184,6 @@
190184
<testCaseId value="MC-3465"/>
191185
<group value="pagebuilder"/>
192186
<group value="pagebuilder-text"/>
193-
<skip>
194-
<issueId value="MC-3720"/>
195-
</skip>
196187
</annotations>
197188
<before>
198189
<createData entity="_defaultCmsPage" stepKey="createCMSPage" />
@@ -248,9 +239,6 @@
248239
<testCaseId value="MC-3466"/>
249240
<group value="pagebuilder"/>
250241
<group value="pagebuilder-text"/>
251-
<skip>
252-
<issueId value="MC-3720"/>
253-
</skip>
254242
</annotations>
255243
<before>
256244
<createData entity="_defaultCmsPage" stepKey="createCMSPage" />
@@ -326,9 +314,6 @@
326314
<testCaseId value="MC-3467"/>
327315
<group value="pagebuilder"/>
328316
<group value="pagebuilder-text"/>
329-
<skip>
330-
<issueId value="MC-3720"/>
331-
</skip>
332317
</annotations>
333318
<before>
334319
<createData entity="_defaultCmsPage" stepKey="createCMSPage" />
@@ -394,9 +379,6 @@
394379
<testCaseId value="MC-3468"/>
395380
<group value="pagebuilder"/>
396381
<group value="pagebuilder-text"/>
397-
<skip>
398-
<issueId value="MC-3720"/>
399-
</skip>
400382
</annotations>
401383
<before>
402384
<createData entity="_defaultCmsPage" stepKey="createCMSPageA" />
@@ -533,7 +515,6 @@
533515
<waitForPageLoad stepKey="waitForPageLoad3"/>
534516
<seeElement selector="{{TextOnStorefront.textInImportantStyle(PageBuilderTextProperty.value)}}" stepKey="seeTextInImportantStyleOnStorefront" />
535517
</test>
536-
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
537518
<test name="TextAddTextWithCustomTinyMCE">
538519
<annotations>
539520
<features value="PageBuilder"/>
@@ -573,29 +554,6 @@
573554
<seeElement selector="{{WYSIWYGOnPageBuilder.textColor}}" stepKey="seeTextColor"/>
574555
<seeElement selector="{{WYSIWYGOnPageBuilder.backgroundColor}}" stepKey="seeBackgroundColor"/>
575556

576-
<!--&lt;!&ndash;Verify FontSize&ndash;&gt;-->
577-
<!--<click selector="{{WYSIWYGOnPageBuilder.fontSize}}" stepKey="clickOnFontSize"/>-->
578-
<!--<see userInput="10px" stepKey="see10px" />-->
579-
<!--<see userInput="12px" stepKey="see12px" />-->
580-
<!--<see userInput="14px" stepKey="see14px" />-->
581-
<!--<see userInput="16px" stepKey="see16px" />-->
582-
<!--<see userInput="18px" stepKey="see18px" />-->
583-
<!--<see userInput="20px" stepKey="see20px" />-->
584-
<!--<see userInput="24px" stepKey="see24px" />-->
585-
<!--<see userInput="26px" stepKey="see26px" />-->
586-
<!--<see userInput="28px" stepKey="see28px" />-->
587-
<!--<see userInput="32px" stepKey="see32px" />-->
588-
<!--<see userInput="34px" stepKey="see34px" />-->
589-
<!--<see userInput="36px" stepKey="see36px" />-->
590-
<!--<see userInput="38px" stepKey="see38px" />-->
591-
<!--<see userInput="40px" stepKey="see40px" />-->
592-
<!--<see userInput="42px" stepKey="see42px" />-->
593-
<!--<see userInput="48px" stepKey="see48px" />-->
594-
<!--<see userInput="52px" stepKey="see52px" />-->
595-
<!--<see userInput="56px" stepKey="see56px" />-->
596-
<!--<see userInput="64px" stepKey="see64px" />-->
597-
<!--<see userInput="72px" stepKey="see72px" />-->
598-
599557
<!--Verify FontStyle on preview-->
600558
<executeJS function="tinyMCE.get('pagebuilder_text_form_content').setContent('{{PageBuilderTextContentTypeDefault.value}}');" stepKey="executeJSFillContent"/>
601559
<click selector="{{WYSIWYGOnPageBuilder.formatSelector}}" stepKey="expandFormatList"/>
@@ -1211,9 +1169,6 @@
12111169
<testCaseId value="MAGETWO-91076"/>
12121170
<group value="pagebuilder"/>
12131171
<group value="pagebuilder-text"/>
1214-
<skip>
1215-
<issueId value="MC-3720"/>
1216-
</skip>
12171172
</annotations>
12181173
<before>
12191174
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
@@ -1380,9 +1335,6 @@
13801335
<group value="pagebuilder"/>
13811336
<group value="pagebuilder-text"/>
13821337
<group value="pagebuilder-customBeforeAfter"/>
1383-
<skip>
1384-
<issueId value="MC-3720"/>
1385-
</skip>
13861338
</annotations>
13871339
<before>
13881340
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
@@ -1630,9 +1582,6 @@
16301582
<group value="pagebuilder"/>
16311583
<group value="pagebuilder-text"/>
16321584
<group value="pagebuilder-column-content"/>
1633-
<skip>
1634-
<issueId value="MC-3720"/>
1635-
</skip>
16361585
</annotations>
16371586
<before>
16381587
<createData entity="_defaultCmsPage" stepKey="createCMSPage" />

app/code/Magento/PageBuilder/docs/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
[Render a backend content type preview]: content-type-preview.md
3838
[Custom Toolbar]: toolbar.md
3939
[Full width page layouts]: full-width-page-layouts.md
40-
[Add image uploader to content type]: image-uploader.md
40+
[Add custom logic to content types]: add-custom-logic.md
4141
[Roadmap and Known Issues]: roadmap.md
4242
[How to create custom PageBuilder content type container]: how-to-create-custom-content-type-container.md
4343

app/code/Magento/PageBuilder/docs/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ It replaces the default WYSIWYG Editor in the Admin area with a highly configura
2929
1. [Render a backend content type preview]
3030
1. [Custom Toolbar]
3131
1. [Full width page layouts]
32+
1. [Add custom logic to content types]
3233
5. [Roadmap and known issues]
3334
6. [How to create custom PageBuilder content type container]
3435

@@ -56,6 +57,6 @@ It replaces the default WYSIWYG Editor in the Admin area with a highly configura
5657
[Render a backend content type preview]: content-type-preview.md
5758
[Custom Toolbar]: toolbar.md
5859
[Full width page layouts]: full-width-page-layouts.md
59-
[Add image uploader to content type]: image-uploader.md
60+
[Add custom logic to content types]: add-custom-logic.md
6061
[Roadmap and Known Issues]: roadmap.md
6162
[How to create custom PageBuilder content type container]: how-to-create-custom-content-type-container.md
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
# Add custom logic to content types
2+
3+
## Navigation
4+
5+
1. [Introduction]
6+
2. [Installation guide]
7+
3. [Contribution guide]
8+
4. [Developer documentation]
9+
1. [Architecture overview]
10+
1. [BlueFoot to PageBuilder data migration]
11+
1. [Third-party content type migration]
12+
1. [Iconography]
13+
1. [Add image uploader to content type]
14+
1. [Module integration]
15+
1. [Additional data configuration]
16+
1. [Content type configuration]
17+
1. [How to add a new content type]
18+
1. [Events]
19+
1. [Bindings]
20+
1. [Master format]
21+
1. [Visual select]
22+
1. [Reuse product conditions in content types]
23+
1. [Store component master format as widget directive]
24+
1. [Use the block chooser UI component]
25+
1. [Use the inline text editing component]
26+
1. [Render a backend content type preview]
27+
1. [Custom Toolbar]
28+
1. [Full width page layouts]
29+
1. **Add custom logic to content types**
30+
5. [Roadmap and known issues]
31+
6. [How to create custom PageBuilder content type container]
32+
33+
[Introduction]: README.md
34+
[Contribution guide]: CONTRIBUTING.md
35+
[Installation guide]: install.md
36+
[Developer documentation]: developer-documentation.md
37+
[Architecture overview]: architecture-overview.md
38+
[BlueFoot to PageBuilder data migration]: bluefoot-data-migration.md
39+
[Third-party content type migration]: new-content-type-example.md
40+
[Iconography]: iconography.md
41+
[Add image uploader to content type]: image-uploader.md
42+
[Module integration]: module-integration.md
43+
[Additional data configuration]: custom-configuration.md
44+
[Content type configuration]: content-type-configuration.md
45+
[How to add a new content type]: how-to-add-new-content-type.md
46+
[Events]: events.md
47+
[Bindings]: bindings.md
48+
[Master format]: master-format.md
49+
[Visual select]: visual-select.md
50+
[Reuse product conditions in content types]: product-conditions.md
51+
[Store component master format as widget directive]: widget-directive.md
52+
[Use the block chooser UI component]: block-chooser-component.md
53+
[Use the inline text editing component]: inline-editing-component.md
54+
[Render a backend content type preview]: content-type-preview.md
55+
[Custom Toolbar]: toolbar.md
56+
[Full width page layouts]: full-width-page-layouts.md
57+
[Add custom logic to content types]: add-custom-logic.md
58+
[Roadmap and Known Issues]: roadmap.md
59+
[How to create custom PageBuilder content type container]: how-to-create-custom-content-type-container.md
60+
61+
You can customize PageBuilder content types by adding your own logic on the frontend.
62+
63+
To add custom logic to content types:
64+
1. [Create a JavaScript widget](#create-a-javascript-widget).
65+
2. [Add XML configuration to load it on the frontend](#add-xml-configuration-to-load-it-on-the-frontend).
66+
67+
### Create a JavaScript widget
68+
69+
Create a JavaScript widget in your module's `/view/frontend/web/js/content-type/{content-type-name}/appearance/{appearance-name}/widget.js` file:
70+
71+
``` javascript
72+
/**
73+
* Copyright © Magento, Inc. All rights reserved.
74+
* See COPYING.txt for license details.
75+
*/
76+
77+
define([
78+
'jquery',
79+
'slick'
80+
], function ($) {
81+
'use strict';
82+
83+
return function (config, sliderElement) {
84+
85+
var $element = $(sliderElement);
86+
87+
/**
88+
* Prevent each slick slider from being initialized more than once which could throw an error.
89+
*/
90+
if ($element.hasClass('slick-initialized')) {
91+
$element.slick('unslick');
92+
}
93+
94+
$element.slick({
95+
autoplay: $element.data('autoplay') === 1,
96+
autoplaySpeed: $element.data('autoplay-speed') || 0,
97+
fade: $element.data('fade') === 1,
98+
infinite: $element.data('is-infinite') === 1,
99+
arrows: $element.data('show-arrows') === 1,
100+
dots: $element.data('show-dots') === 1
101+
});
102+
};
103+
});
104+
105+
```
106+
107+
### Add XML configuration to load it on the frontend
108+
109+
Add XML configuration to load it on the frontend, and on the stage, so that you can preview content inside both the block and dynamic block content types.
110+
111+
Add the following configuration to the `etc/di.xml` file in your custom module directory:
112+
113+
``` xml
114+
<type name="Magento\PageBuilder\Model\Config\ContentType\WidgetInitializer">
115+
<arguments>
116+
<argument name="config" xsi:type="array">
117+
<item name="%content-type-name%" xsi:type="array">
118+
<!-- Name is the appearance name -->
119+
<item name="default" xsi:type="array">
120+
<!--required argument-->
121+
<item name="component" xsi:type="string">%{vendor-path}/js/content-type/{content-type-name}/appearance/{appearance-name}/widget%</item>
122+
<!--optional if you need provide some config for your widget-->
123+
<item name="config" xsi:type="array">
124+
<item name="buttonSelector" xsi:type="string">.pagebuilder-slide-button</item>
125+
<item name="showOverlay" xsi:type="string">hover</item>
126+
</item>
127+
<!--optional if you want load widget per appearance-->
128+
<item name="appearance" xsi:type="string">default</item>
129+
</item>
130+
</item>
131+
</argument>
132+
</arguments>
133+
</type>
134+
```

app/code/Magento/PageBuilder/docs/architecture-overview.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
1. [Render a backend content type preview]
2727
1. [Custom Toolbar]
2828
1. [Full width page layouts]
29+
1. [Add custom logic to content types]
2930
5. [Roadmap and known issues]
3031
6. [How to create custom PageBuilder content type container]
3132

@@ -53,7 +54,7 @@
5354
[Render a backend content type preview]: content-type-preview.md
5455
[Custom Toolbar]: toolbar.md
5556
[Full width page layouts]: full-width-page-layouts.md
56-
[Add image uploader to content type]: image-uploader.md
57+
[Add custom logic to content types]: add-custom-logic.md
5758
[Roadmap and Known Issues]: roadmap.md
5859
[How to create custom PageBuilder content type container]: how-to-create-custom-content-type-container.md
5960

app/code/Magento/PageBuilder/docs/bindings.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
1. [Render a backend content type preview]
2727
1. [Custom Toolbar]
2828
1. [Full width page layouts]
29+
1. [Add custom logic to content types]
2930
5. [Roadmap and known issues]
3031
6. [How to create custom PageBuilder content type container]
3132

@@ -53,7 +54,7 @@
5354
[Render a backend content type preview]: content-type-preview.md
5455
[Custom Toolbar]: toolbar.md
5556
[Full width page layouts]: full-width-page-layouts.md
56-
[Add image uploader to content type]: image-uploader.md
57+
[Add custom logic to content types]: add-custom-logic.md
5758
[Roadmap and Known Issues]: roadmap.md
5859
[How to create custom PageBuilder content type container]: how-to-create-custom-content-type-container.md
5960

app/code/Magento/PageBuilder/docs/block-chooser-component.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@
2626
1. [Render a backend content type preview]
2727
1. [Custom Toolbar]
2828
1. [Full width page layouts]
29+
1. [Add custom logic to content types]
2930
5. [Roadmap and known issues]
30-
6. [How to create custom PageBuilder content type container
31+
6. [How to create custom PageBuilder content type container]
3132

3233
[Introduction]: README.md
3334
[Contribution guide]: CONTRIBUTING.md
@@ -53,11 +54,10 @@
5354
[Render a backend content type preview]: content-type-preview.md
5455
[Custom Toolbar]: toolbar.md
5556
[Full width page layouts]: full-width-page-layouts.md
56-
[Add image uploader to content type]: image-uploader.md
57+
[Add custom logic to content types]: add-custom-logic.md
5758
[Roadmap and Known Issues]: roadmap.md
5859
[How to create custom PageBuilder content type container]: how-to-create-custom-content-type-container.md
5960

60-
6161
## What's in this topic
6262

6363
This topic describes how to use the block chooser UI component for a custom content type.

0 commit comments

Comments
 (0)