diff --git a/app/code/Magento/CatalogPageBuilderAnalytics/composer.json b/app/code/Magento/CatalogPageBuilderAnalytics/composer.json
index 6d06431f8cc..9050c9c13d9 100644
--- a/app/code/Magento/CatalogPageBuilderAnalytics/composer.json
+++ b/app/code/Magento/CatalogPageBuilderAnalytics/composer.json
@@ -6,8 +6,8 @@
},
"require": {
"magento/module-page-builder-analytics": "*",
- "magento/module-catalog": "~103.0.5",
- "magento/framework": "~102.0.5",
+ "magento/module-catalog": "*",
+ "magento/framework": "*",
"php": "~7.1.3||~7.2.0||~7.3.0"
},
"type": "magento2-module",
diff --git a/app/code/Magento/CmsPageBuilderAnalytics/composer.json b/app/code/Magento/CmsPageBuilderAnalytics/composer.json
index bac8c5420bc..0e725385c58 100644
--- a/app/code/Magento/CmsPageBuilderAnalytics/composer.json
+++ b/app/code/Magento/CmsPageBuilderAnalytics/composer.json
@@ -7,7 +7,7 @@
"require": {
"magento/module-page-builder-analytics": "*",
"magento/module-cms": "*",
- "magento/framework": "~102.0.5",
+ "magento/framework": "*",
"php": "~7.1.3||~7.2.0||~7.3.0"
},
"type": "magento2-module",
diff --git a/app/code/Magento/PageBuilder/Test/Mftf/ActionGroup/AdminDisableWYSIWYGActionGroup.xml b/app/code/Magento/PageBuilder/Test/Mftf/ActionGroup/AdminDisableWYSIWYGActionGroup.xml
new file mode 100644
index 00000000000..2c6ba7401c3
--- /dev/null
+++ b/app/code/Magento/PageBuilder/Test/Mftf/ActionGroup/AdminDisableWYSIWYGActionGroup.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/PageBuilder/Test/Mftf/ActionGroup/AdminEnableWYSIWYGActionGroup.xml b/app/code/Magento/PageBuilder/Test/Mftf/ActionGroup/AdminEnableWYSIWYGActionGroup.xml
new file mode 100644
index 00000000000..1c5b811bb94
--- /dev/null
+++ b/app/code/Magento/PageBuilder/Test/Mftf/ActionGroup/AdminEnableWYSIWYGActionGroup.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/PageBuilder/Test/Mftf/Suite/PageBuilderDisabledSuite.xml b/app/code/Magento/PageBuilder/Test/Mftf/Suite/PageBuilderDisabledSuite.xml
deleted file mode 100644
index a4871fd8fc0..00000000000
--- a/app/code/Magento/PageBuilder/Test/Mftf/Suite/PageBuilderDisabledSuite.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/code/Magento/PageBuilder/composer.json b/app/code/Magento/PageBuilder/composer.json
index 5ca2b62ddfd..ddebd9e2ad0 100644
--- a/app/code/Magento/PageBuilder/composer.json
+++ b/app/code/Magento/PageBuilder/composer.json
@@ -2,20 +2,20 @@
"name": "magento/module-page-builder",
"description": "Page Builder module",
"require": {
- "magento/framework": "~102.0.5",
+ "magento/framework": "*",
"magento/module-eav": "*",
- "magento/module-store": "~101.0.5",
- "magento/module-backend": "~101.0.5",
+ "magento/module-store": "*",
+ "magento/module-backend": "*",
"magento/module-cms": "*",
- "magento/module-catalog": "~103.0.5",
+ "magento/module-catalog": "*",
"magento/module-catalog-inventory": "*",
- "magento/module-config": "~101.1.5",
+ "magento/module-config": "*",
"magento/module-ui": "*",
"magento/module-variable": "*",
"magento/module-widget": "*",
"magento/module-catalog-widget": "*",
- "magento/module-rule": "~100.3.5",
- "magento/module-directory": "~100.3.5",
+ "magento/module-rule": "*",
+ "magento/module-directory": "*",
"magento/module-email": "*",
"magento/module-theme": "*",
"magento/module-wishlist": "*",
diff --git a/app/code/Magento/PageBuilder/view/adminhtml/web/css/source/_common.less b/app/code/Magento/PageBuilder/view/adminhtml/web/css/source/_common.less
index 731e969de63..49b139e340a 100644
--- a/app/code/Magento/PageBuilder/view/adminhtml/web/css/source/_common.less
+++ b/app/code/Magento/PageBuilder/view/adminhtml/web/css/source/_common.less
@@ -8,9 +8,9 @@
// ___________________________________________________________________
.transition {
- -o-transition: .5s;
- -ms-transition: .5s;
-moz-transition: .5s;
+ -ms-transition: .5s;
+ -o-transition: .5s;
-webkit-transition: .5s;
transition: .5s;
}
@@ -27,12 +27,6 @@
//
// Commented Backslash Hack
// ---------------------------------------------
-
-.clearfix {
- display: block;
-}
-
-
* html .clearfix {
height: 1%;
}
diff --git a/app/code/Magento/PageBuilderAnalytics/composer.json b/app/code/Magento/PageBuilderAnalytics/composer.json
index 9fb471f0bda..e61b68c5daa 100644
--- a/app/code/Magento/PageBuilderAnalytics/composer.json
+++ b/app/code/Magento/PageBuilderAnalytics/composer.json
@@ -2,9 +2,9 @@
"name": "magento/module-page-builder-analytics",
"description": "Page Builder Analytics module",
"require": {
- "magento/module-analytics": "~100.3.5",
+ "magento/module-analytics": "*",
"magento/module-page-builder": "*",
- "magento/framework": "~102.0.5",
+ "magento/framework": "*",
"php": "~7.1.3||~7.2.0||~7.3.0"
},
"type": "magento2-module",
diff --git a/dev/tests/integration/testsuite/Magento/PageBuilder/Controller/Adminhtml/ContentType/Image/UploadTest.php b/dev/tests/integration/testsuite/Magento/PageBuilder/Controller/Adminhtml/ContentType/Image/UploadTest.php
index b4efe464a2a..2fd1b1919e1 100644
--- a/dev/tests/integration/testsuite/Magento/PageBuilder/Controller/Adminhtml/ContentType/Image/UploadTest.php
+++ b/dev/tests/integration/testsuite/Magento/PageBuilder/Controller/Adminhtml/ContentType/Image/UploadTest.php
@@ -3,41 +3,45 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-
declare(strict_types=1);
namespace Magento\PageBuilder\Controller\Adminhtml\ContentType\Image;
+use Magento\Framework\App\ObjectManager;
+use Magento\Framework\Controller\Result\Json;
+use Magento\Framework\Controller\Result\JsonFactory;
use Magento\Framework\File\Mime;
-use Magento\PageBuilder\Controller\Adminhtml\ContentType\Image\Upload as Controller;
-
-/**
- * Class UploadTest
- */
-class UploadTest extends \PHPUnit\Framework\TestCase
+use Magento\Framework\File\Uploader;
+use Magento\Framework\File\UploaderFactory;
+use Magento\Framework\ObjectManagerInterface;
+use Magento\PageBuilder\Controller\Adminhtml\ContentType\Image\Upload as UploadController;
+use PHPUnit\Framework\MockObject\MockObject;
+use PHPUnit\Framework\TestCase;
+
+class UploadTest extends TestCase
{
/**
- * @var \Magento\PageBuilder\Controller\Adminhtml\ContentType\Image\Upload
+ * @var UploadController
*/
private $controller;
/**
- * @var \Magento\Framework\ObjectManagerInterface
+ * @var ObjectManagerInterface
*/
private $objectManager;
/**
- * @var \Magento\Framework\File\UploaderFactory|\PHPUnit_Framework_MockObject_MockObject
+ * @var UploaderFactory|MockObject
*/
private $uploaderFactory;
/**
- * @var \Magento\Framework\Controller\Result\Json|\PHPUnit_Framework_MockObject_MockObject
+ * @var Json|MockObject
*/
private $resultJson;
/**
- * @var \Magento\Framework\Controller\Result\JsonFactory|\PHPUnit_Framework_MockObject_MockObject
+ * @var JsonFactory|MockObject
*/
private $resultJsonFactory;
@@ -46,23 +50,25 @@ class UploadTest extends \PHPUnit\Framework\TestCase
*/
protected function setUp()
{
- $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
+ $this->objectManager = ObjectManager::getInstance();
- $this->uploaderFactory = $this->createPartialMock(\Magento\Framework\File\UploaderFactory::class, ['create']);
+ $this->uploaderFactory = $this->createPartialMock(UploaderFactory::class, ['create']);
- $this->resultJson = $this->getMockBuilder(\Magento\Framework\Controller\Result\Json::class)
+ $this->resultJson = $this->getMockBuilder(Json::class)
->setMethods(['setData'])
->disableOriginalConstructor()
->getMock();
- $this->resultJsonFactory = $this->getMockBuilder(\Magento\Framework\Controller\Result\JsonFactory::class)
+ $this->resultJsonFactory = $this->getMockBuilder(JsonFactory::class)
->setMethods(['create'])
->disableOriginalConstructor()
->getMock();
- $this->resultJsonFactory->expects($this->once())->method('create')->willReturn($this->resultJson);
+ $this->resultJsonFactory->expects($this->once())
+ ->method('create')
+ ->willReturn($this->resultJson);
- $this->controller = $this->objectManager->create(Controller::class, [
+ $this->controller = $this->objectManager->create(UploadController::class, [
'resultJsonFactory' => $this->resultJsonFactory,
'uploaderFactory' => $this->uploaderFactory
]);
@@ -78,33 +84,40 @@ protected function tearDown()
/**
* Assert that file validation passes when uploaded file has correct extension and valid mime type
+ * @magentoAppArea adminhtml
*/
public function testFileValidationPassesWhenFileHasCorrectExtensionAndValidMimeType()
{
- $valid_file_pathname = realpath(dirname(__FILE__) . '/../../../../_files/uploader/a.png');
+ $valid_file_pathname = realpath(__DIR__ . '/../../../../_files/uploader/a.png');
- $_FILES = [
- 'background_image' => [
- 'type' => 'image/png',
- 'name' => basename($valid_file_pathname),
- 'tmp_name' => $valid_file_pathname,
- 'size' => filesize($valid_file_pathname),
- 'error' => UPLOAD_ERR_OK,
- ]
- ];
+ $this->setFilesGlobalMock($valid_file_pathname);
+ $this->setUploaderMockForField('background_image');
- $uploader = $this->objectManager->create(\Magento\Framework\File\Uploader::class, [
- 'fileId' => 'background_image',
- 'fileMime' => $this->objectManager->create(Mime::class),
- ]);
+ $this->resultJson->expects($this->once())
+ ->method('setData')
+ ->willReturnCallback(function ($result) {
+ $this->assertNotEquals([
+ 'error' => 'File validation failed.',
+ 'errorcode' => 0
+ ], $result);
+ });
- $this->uploaderFactory
- ->expects($this->once())
- ->method('create')
- ->will($this->returnValue($uploader));
+ $this->controller->execute();
+ }
+
+ /**
+ * Assert that file validation fails when uploaded file has correct extension but invalid mime type
+ * @magentoAppArea adminhtml
+ */
+ public function testFileValidationFailsWhenFileHasCorrectExtensionButInvalidMimeType()
+ {
+ $invalid_file_pathname = realpath(__DIR__ . '/../../../../_files/uploader/not-a.png');
+
+ $this->setFilesGlobalMock($invalid_file_pathname);
+ $this->setUploaderMockForField('background_image');
$this->resultJson->expects($this->once())->method('setData')->willReturnCallback(function ($result) {
- $this->assertNotEquals([
+ $this->assertEquals([
'error' => 'File validation failed.',
'errorcode' => 0
], $result);
@@ -114,24 +127,15 @@ public function testFileValidationPassesWhenFileHasCorrectExtensionAndValidMimeT
}
/**
- * Assert that file validation fails when uploaded file has correct extension but invalid mime type
+ * Initiates Uploader object for `$fieldId` and returns as a result of `UploaderFactory::create()`
+ *
+ * @param string $fieldId
+ * @return void
*/
- public function testFileValidationFailsWhenFileHasCorrectExtensionButInvalidMimeType()
+ private function setUploaderMockForField(string $fieldId): void
{
- $invalid_file_pathname = realpath(dirname(__FILE__) . '/../../../../_files/uploader/not-a.png');
-
- $_FILES = [
- 'background_image' => [
- 'type' => 'image/png',
- 'name' => basename($invalid_file_pathname),
- 'tmp_name' => $invalid_file_pathname,
- 'size' => filesize($invalid_file_pathname),
- 'error' => UPLOAD_ERR_OK,
- ]
- ];
-
- $uploader = $this->objectManager->create(\Magento\Framework\File\Uploader::class, [
- 'fileId' => 'background_image',
+ $uploader = $this->objectManager->create(Uploader::class, [
+ 'fileId' => $fieldId,
'fileMime' => $this->objectManager->create(Mime::class),
]);
@@ -139,14 +143,24 @@ public function testFileValidationFailsWhenFileHasCorrectExtensionButInvalidMime
->expects($this->once())
->method('create')
->will($this->returnValue($uploader));
+ }
- $this->resultJson->expects($this->once())->method('setData')->willReturnCallback(function ($result) {
- $this->assertEquals([
- 'error' => 'File validation failed.',
- 'errorcode' => 0
- ], $result);
- });
-
- $this->controller->execute();
+ /**
+ * Mock that `$pathname` was uploaded (mock of `$_FILES` array)
+ *
+ * @param string $pathname
+ * @return void
+ */
+ private function setFilesGlobalMock(string $pathname): void
+ {
+ $_FILES = [
+ 'background_image' => [
+ 'type' => 'image/png',
+ 'name' => basename($pathname),
+ 'tmp_name' => $pathname,
+ 'size' => filesize($pathname),
+ 'error' => UPLOAD_ERR_OK,
+ ]
+ ];
}
}
diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/pagebuilder.txt b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/pagebuilder.txt
new file mode 100644
index 00000000000..8a35262aa16
--- /dev/null
+++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/pagebuilder.txt
@@ -0,0 +1 @@
+Magento/PageBuilder/Model/ResourceModel/Template/Grid
diff --git a/docs_drafts/how-to/how-to-use-upgrade-library.md b/docs/how-to/how-to-use-upgrade-library.md
similarity index 68%
rename from docs_drafts/how-to/how-to-use-upgrade-library.md
rename to docs/how-to/how-to-use-upgrade-library.md
index c001e3cc18a..fd835963b20 100644
--- a/docs_drafts/how-to/how-to-use-upgrade-library.md
+++ b/docs/how-to/how-to-use-upgrade-library.md
@@ -1,25 +1,31 @@
-# How to use the content type upgrade library
+# How to upgrade content types
Before version 1.3, changes to a content-type configuration could (and usually would) break the existing content that was saved with the previous configuration. Why? Because a content type's configuration maps data from its source (the master format) to its display templates. So when the configuration mapping changes, the display of existing content might also change. With significant configuration changes, data (such as styles, attributes, and html) is lost. Such changes cause existing content to appear incorrectly, or not at all.
To fix this limitation for versions 1.3+, Page Builder uses Magento's native upgrade mechanism, coupled with our content upgrade helpers. These helpers convert existing content so that it maps to new configurations and displays correctly.
-## Example usage for Row
+## Example: Updating the Row content type
-The Page Builder team recently had to change the configuration of the Row's full-width appearance to fix a layout issue. The fix was simple. We moved a style attribute from one element in the Row's full-width appearance to another element. But without the upgrade helpers, our change to the Row's configuration would have broken all previously saved Page Builder content with Rows. And because all Page Builder content starts with a Row, all Page Builder content would be broken!
+Let's imagine that the Page Builder team needs to change the configuration of the Row's full-width appearance to fix a layout issue. The fix is simple. We need to move a style attribute from one element in the Row's full-width appearance to another element. But without the upgrade helpers, our change to the Row's configuration would break all previously saved Page Builder content that uses Rows. And because all Page Builder content is wrapped in a Row, changing the Row would break all Page Builder content!
-To fix this issue, we used the Page Builder DOM helper classes (`Magento\PageBuilder\Model\Dom\*`) to create a converter and a data patch for the native Row content type:
+To fix this issue, we created a set of Page Builder DOM helper classes (`Magento\PageBuilder\Model\Dom\*`) that we can use to update all our native content types (including the Row) that have already been stored in the database.
-1. **Converter** (See `FixFullWidthRowPadding.php`)
-2. **Data Patch** (See `UpgradeFullWidthPadding.php`)
+## Steps overview
+There are three steps to upgrading a content type when changing its configuration:
- 
+1. Create a Converter (Example: `FixFullWidthRowPadding.php`)
+2. Create a Data Patch (Example: `UpgradeFullWidthPadding.php`)
+3. Update the UpgradableEntitiesPool (for custom entities)(`Magento\PageBuilder\Model\UpgradableEntitiesPool`)
-### Converter class example
+For our Row example, the Page Builder team would add the following files to the `Magento/PageBuilder/Setup` directories:
-The converter class implements the `DataConverterInterface`. Specifically, it implements the `convert` function where it uses Page Builder's DOM helper classes to change the DOM of the Row content type within each master format it receives.
+
-Page Builder's `FixFullWidthRowPadding` converter class is provided here as an example implementation:
+### Step 1: Create a Converter
+
+For our Row example, the first task is to create a converter class that implements the `DataConverterInterface`. Specifically, it implements the `convert` function where it uses Page Builder's DOM helper classes to change the DOM of the Row content type within each master format it receives.
+
+Our converter class for fixing a row padding problem might be called `FixFullWidthRowPadding`, with the following example implementation:
```php
+
+
+ -
+
- blog_id
+ -
+
- true
+
+
+
+
+
+```
+
+In such cases, your additional entity will be merged with the default entities from `Magento/PageBuilder/etc/di.xml`:
```xml
@@ -194,23 +231,6 @@ The `UpgradableEntitiesPool` provides the locations in the database where Page B
```
-If you have created additional database entities for storing Page Builder content, you need to add your custom entity to your `etc/di.xml` as shown in the following example:
-
-```xml
-
-
-
- -
-
- custom_block_id
- -
-
- true
-
-
-
-
-
-```
-
## How to upgrade your custom content types
To use Page Builder's content upgrade helpers for your own content-type configuration changes, follow these steps:
diff --git a/docs/images/upgrade-framework-additional-entities.png b/docs/images/upgrade-framework-additional-entities.png
new file mode 100644
index 00000000000..6c2bbdf3bc9
Binary files /dev/null and b/docs/images/upgrade-framework-additional-entities.png differ
diff --git a/docs/images/upgrade-framework-example-custom.png b/docs/images/upgrade-framework-example-custom.png
new file mode 100644
index 00000000000..24271a9c39c
Binary files /dev/null and b/docs/images/upgrade-framework-example-custom.png differ
diff --git a/docs/images/upgrade-framework-example-pb.png b/docs/images/upgrade-framework-example-pb.png
new file mode 100644
index 00000000000..dc95365798a
Binary files /dev/null and b/docs/images/upgrade-framework-example-pb.png differ
diff --git a/docs_drafts/images/upgrade-framework-example-custom.png b/docs_drafts/images/upgrade-framework-example-custom.png
deleted file mode 100644
index 6aeee8319ea..00000000000
Binary files a/docs_drafts/images/upgrade-framework-example-custom.png and /dev/null differ
diff --git a/docs_drafts/images/upgrade-framework-example-pb.png b/docs_drafts/images/upgrade-framework-example-pb.png
deleted file mode 100644
index c18b55b8692..00000000000
Binary files a/docs_drafts/images/upgrade-framework-example-pb.png and /dev/null differ