Skip to content

Commit 7474571

Browse files
committed
Merge remote-tracking branch 'origin/MAGETWO-92406-tabs-front-end-loading' into MAGETWO-92775-tabs
2 parents c47cff5 + a0514a5 commit 7474571

File tree

126 files changed

+4548
-1298
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+4548
-1298
lines changed

app/code/Magento/PageBuilder/Block/Adminhtml/ContentType/Products/Conditions.php renamed to app/code/Magento/PageBuilder/Block/Adminhtml/Form/Element/ProductConditions.php

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@
66

77
declare(strict_types=1);
88

9-
namespace Magento\PageBuilder\Block\Adminhtml\ContentType\Products;
9+
namespace Magento\PageBuilder\Block\Adminhtml\Form\Element;
1010

1111
use Magento\Backend\Block\Template;
1212

1313
/**
1414
* The block used to render the conditions rule tree form within the PageBuilder interface.
1515
*/
16-
class Conditions extends Template
16+
class ProductConditions extends Template
1717
{
1818
/**
1919
*
2020
* @var string
2121
*/
22-
protected $_template = 'Magento_PageBuilder::content_type/products/conditions.phtml';
22+
protected $_template = 'Magento_PageBuilder::form/element/conditions.phtml';
2323

2424
/**
2525
* @var \Magento\Framework\Serialize\Serializer\Json
@@ -41,42 +41,47 @@ public function __construct(
4141
parent::__construct($context, $data);
4242
}
4343

44-
/**
45-
* Returns the form namespace to be used with the JS config
46-
*
47-
* @return string
48-
*/
49-
public function getFormNamespace(): string
50-
{
51-
return 'pagebuilder_products_form';
52-
}
53-
5444
/**
5545
* Returns an array of arguments to pass to the condition tree UIComponent
5646
*
5747
* @return array
5848
*/
5949
private function getConfig(): array
6050
{
51+
$formNamespace = $this->getData('formNamespace');
52+
$attribute = $this->getData('attribute');
53+
6154
return [
62-
'formNamespace' => $this->getFormNamespace(),
55+
'formNamespace' => $formNamespace,
6356
'componentUrl' => $this->getUrl(
64-
'pagebuilder/contenttype/products_conditions',
65-
['form_namespace' => $this->getFormNamespace()]
57+
'pagebuilder/form/element_productconditions',
58+
[
59+
'form_namespace' => $formNamespace,
60+
'prefix' => $attribute,
61+
]
6662
),
67-
'jsObjectName' => $this->getFormNamespace(),
63+
'jsObjectName' => $formNamespace . '_' . $attribute,
6864
'childComponentUrl' => $this->getUrl(
69-
'pagebuilder/contenttype/products_conditions_child',
70-
['form_namespace' => $this->getFormNamespace()]
65+
'pagebuilder/form/element_productconditions_child',
66+
[
67+
'form_namespace' => $formNamespace,
68+
'prefix' => $attribute,
69+
]
7170
),
71+
'attribute' => $attribute,
7272
];
7373
}
7474

75+
/**
76+
* Creates a JSON string containing the configuration for the needed JS components in the mage-init format
77+
*
78+
* @return string
79+
*/
7580
public function getConfigJson(): string
7681
{
7782
return $this->serializer->serialize([
78-
'[data-role=pagebuilder-product-conditions-form-placeholder]' => [
79-
'Magento_PageBuilder/js/content-type/products/conditions-loader' => $this->getConfig(),
83+
'[data-role=pagebuilder-conditions-form-placeholder-' . $this->getData('attribute') . ']' => [
84+
'Magento_PageBuilder/js/form/element/conditions-loader' => $this->getConfig(),
8085
]
8186
]);
8287
}

app/code/Magento/PageBuilder/Controller/Adminhtml/ContentType/Products/Conditions.php renamed to app/code/Magento/PageBuilder/Controller/Adminhtml/Form/Element/ProductConditions.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66

77
declare(strict_types=1);
88

9-
namespace Magento\PageBuilder\Controller\Adminhtml\ContentType\Products;
9+
namespace Magento\PageBuilder\Controller\Adminhtml\Form\Element;
1010

1111
use Magento\Rule\Model\Condition\Combine;
1212

1313
/**
1414
* Responsible for rendering the top-level conditions rule tree using the provided params
1515
*/
16-
class Conditions extends \Magento\CatalogWidget\Controller\Adminhtml\Product\Widget
16+
class ProductConditions extends \Magento\CatalogWidget\Controller\Adminhtml\Product\Widget
1717
{
1818
/**
1919
* @var \Magento\CatalogWidget\Model\Rule
@@ -45,9 +45,13 @@ public function __construct(
4545
*/
4646
public function execute()
4747
{
48-
$conditions = $this->getRequest()->getParam('conditions');
49-
$this->rule->loadPost(['conditions'=> $this->serializer->unserialize($conditions)]);
48+
$prefix = $this->getRequest()->getParam('prefix', 'conditions');
49+
$conditionsEncoded = $this->getRequest()->getParam('conditions');
5050
$conditions = $this->rule->getConditions();
51+
$conditions->setData('prefix', $prefix);
52+
// The rule class expects something to be set in the prefix field before the conditions are loaded
53+
$conditions->setData($prefix, []);
54+
$this->rule->loadPost(['conditions' => $this->serializer->unserialize($conditionsEncoded)]);
5155
$formName = $this->getRequest()->getParam('form_namespace');
5256
// Combine class recursively sets jsFormObject so we don't need to
5357
$conditions->setJsFormObject($formName);

app/code/Magento/PageBuilder/Controller/Adminhtml/ContentType/Products/Conditions/Child.php renamed to app/code/Magento/PageBuilder/Controller/Adminhtml/Form/Element/ProductConditions/Child.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@
66

77
declare(strict_types=1);
88

9-
namespace Magento\PageBuilder\Controller\Adminhtml\ContentType\Products\Conditions;
9+
namespace Magento\PageBuilder\Controller\Adminhtml\Form\Element\ProductConditions;
1010

1111
use Magento\Rule\Model\Condition\AbstractCondition;
12-
use Magento\Rule\Model\Condition\Combine;
1312

1413
/**
1514
* Responsible for rendering the child elements of the conditions rule tree using the provided params
@@ -19,7 +18,7 @@ class Child extends \Magento\CatalogWidget\Controller\Adminhtml\Product\Widget
1918
/**
2019
* @var \Magento\CatalogWidget\Model\Rule
2120
*/
22-
protected $rule;
21+
private $rule;
2322

2423
/**
2524
* @param \Magento\Backend\App\Action\Context $context
@@ -48,7 +47,7 @@ public function execute()
4847
->setId($id)
4948
->setType($className)
5049
->setRule($this->rule)
51-
->setPrefix('conditions');
50+
->setPrefix($this->getRequest()->getParam('prefix', 'conditions'));
5251

5352
if (!empty($typeData[1])) {
5453
$model->setAttribute($typeData[1]);

app/code/Magento/PageBuilder/Model/Wysiwyg/DefaultConfigProvider.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
76
declare(strict_types=1);
8-
97
namespace Magento\PageBuilder\Model\Wysiwyg;
108

119
/**
@@ -17,12 +15,10 @@ class DefaultConfigProvider implements \Magento\Framework\Data\Wysiwyg\ConfigPro
1715
* @var \Magento\Framework\View\Asset\Repository
1816
*/
1917
private $assetRepo;
20-
2118
/**
2219
* @var array
2320
*/
2421
private $additionalSettings;
25-
2622
/**
2723
* @param \Magento\Framework\View\Asset\Repository $assetRepo
2824
* @param array $additionalSettings
@@ -34,7 +30,6 @@ public function __construct(
3430
$this->assetRepo = $assetRepo;
3531
$this->additionalSettings = $additionalSettings;
3632
}
37-
3833
/**
3934
* {@inheritdoc}
4035
*/
@@ -43,7 +38,8 @@ public function getConfig(\Magento\Framework\DataObject $config): \Magento\Frame
4338
$config->addData([
4439
'tinymce4' => [
4540
'toolbar' => 'undo redo | styleselect | fontsizeselect | forecolor backcolor | bold italic underline' .
46-
' | alignleft aligncenter alignright | numlist bullist | link image table charmap | widgets variables',
41+
' | alignleft aligncenter alignright | numlist bullist | link image table charmap' .
42+
' | widgets variables',
4743
'plugins' => implode(
4844
' ',
4945
[

app/code/Magento/PageBuilder/Setup/DataConverter/Renderer/Product.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,6 @@ public function render(array $itemData, array $additionalData = [])
134134
'data-role' => 'product',
135135
'data-appearance' => 'grid',
136136
'class' => $eavData['css_classes'] ?? '',
137-
'data-products-count' => $productsCount,
138-
'data-conditions-encoded' => $this->escaper->escapeHtml($this->jsonEncoder->serialize($conditions)),
139-
'data-sku' => $productSku
140137
];
141138

142139
if (isset($itemData['formData'])) {

app/code/Magento/PageBuilder/Setup/DataConverter/Renderer/ProductList.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,6 @@ public function render(array $itemData, array $additionalData = [])
105105
'data-role' => 'products',
106106
'data-appearance' => 'grid',
107107
'class' => $itemData['formData']['css_classes'] ?? '',
108-
'data-products-count' => $productsCount,
109-
'data-conditions-encoded' => $this->escaper->escapeHtml($this->jsonEncoder->serialize($conditions))
110108
];
111109

112110
if (isset($itemData['formData'])) {

app/code/Magento/PageBuilder/Test/Mftf/ActionGroup/SliderActionGroup.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@
5151
<click selector="{{SliderInAdmin.slideOptionsRemove}}" stepKey="clickRemoveContentType"/>
5252
<wait time="0.5" stepKey="waitForRemovalAnimation" />
5353
</actionGroup>
54+
<actionGroup name="duplicateSlide">
55+
<waitForElementVisible time="10" selector="{{SliderInAdmin.sliderContainer}}" stepKey="waitForContentBlockInStageVisible" />
56+
<click selector="{{SliderInAdmin.activeSlideNavigationDot}}" stepKey="clickActiveSlideNavigationDot"/>
57+
<seeElement selector="{{SliderInAdmin.slideOptions}}" stepKey="seeContentBlockOptionsMenu"/>
58+
<click selector="{{SliderInAdmin.slideOptionsDuplicate}}" stepKey="clickRemoveContentBlock"/>
59+
</actionGroup>
5460
<actionGroup name="addSlide">
5561
<waitForElementVisible time="10" selector="{{SliderInAdmin.sliderContainer}}" stepKey="waitForContentTypeInStageVisible" />
5662
<click stepKey="focusOnSlider" selector="{{SliderInAdmin.sliderContainer}}"/>

app/code/Magento/PageBuilder/Test/Mftf/Data/ContentTypeData.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<entity name="PageBuilderTextContentType" type="pagebuilder_content_type">
3131
<data key="name">Text</data>
3232
<data key="section">General</data>
33-
<data key="role">textarea</data>
33+
<data key="role">text</data>
3434
<data key="pageNamePrefix">text</data>
3535
</entity>
3636
<entity name="PageBuilderHeadingContentType" type="pagebuilder_content_type">

app/code/Magento/PageBuilder/Test/Mftf/Data/SlideData.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -259,13 +259,13 @@
259259
<data key="name">Show Button</data>
260260
<data key="section">general</data>
261261
<data key="fieldName">show_button</data>
262-
<data key="value">never_show</data>
262+
<data key="value">never</data>
263263
</entity>
264264
<entity name="PageBuilderSlideShowButtonOnHoverProperty" type="pagebuilder_Slide_showButton_property">
265265
<data key="name">Show Button</data>
266266
<data key="section">general</data>
267267
<data key="fieldName">show_button</data>
268-
<data key="value">on_hover</data>
268+
<data key="value">hover</data>
269269
</entity>
270270
<entity name="PageBuilderSlideShowContentOverlayAlwaysProperty" type="pagebuilder_Slide_showContentOverlay_property">
271271
<data key="name">Show Overlay</data>
@@ -277,19 +277,19 @@
277277
<data key="name">Show Overlay</data>
278278
<data key="section">general</data>
279279
<data key="fieldName">show_overlay</data>
280-
<data key="value">on_hover</data>
280+
<data key="value">hover</data>
281281
</entity>
282282
<entity name="PageBuilderSlideShowContentOverlayNeverShowProperty" type="pagebuilder_Slide_showContentOverlay_property">
283283
<data key="name">Show Overlay</data>
284284
<data key="section">general</data>
285285
<data key="fieldName">show_overlay</data>
286-
<data key="value">never_show</data>
286+
<data key="value">never</data>
287287
</entity>
288288
<entity name="PageBuilderSlideShowContentOverlayDefaultProperty" type="pagebuilder_Slide_showContentOverlayDefault_property">
289289
<data key="name">Show Overlay</data>
290290
<data key="section">general</data>
291291
<data key="fieldName">show_overlay</data>
292-
<data key="value">never_show</data>
292+
<data key="value">never</data>
293293
</entity>
294294
<entity name="PageBuilderSlideContentOverlayColorProperty" type="pagebuilder_Slide_contentOverlayColor_property">
295295
<data key="name">Overlay Color</data>

app/code/Magento/PageBuilder/Test/Mftf/Data/TextData.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,21 @@
1212
<entity name="PageBuilderTextContentType" type="pagebuilder_text_property">
1313
<data key="name">Text</data>
1414
<data key="section">General</data>
15-
<data key="fieldName">textarea</data>
15+
<data key="fieldName">text</data>
1616
<data key="cmsPageLinkName" unique="suffix">cms-page-link-</data>
1717
<data key="value">test string</data>
1818
</entity>
1919
<entity name="PageBuilderTextContentTypeDefault" type="pagebuilder_text_property">
2020
<data key="name">Text</data>
2121
<data key="section">General</data>
22-
<data key="fieldName">textarea</data>
22+
<data key="fieldName">text</data>
2323
<data key="cmsPageLinkName" unique="suffix">cms-page-link-</data>
2424
<data key="value">Text</data>
2525
</entity>
2626
<entity name="PageBuilderTextContentTypeEmpty" type="pagebuilder_text_property">
2727
<data key="name">Text</data>
2828
<data key="section">General</data>
29-
<data key="fieldName">textarea</data>
29+
<data key="fieldName">text</data>
3030
<data key="cmsPageLinkName" unique="suffix">cms-page-link-</data>
3131
<data key="value"/>
3232
</entity>

0 commit comments

Comments
 (0)