Skip to content

Commit 84225c6

Browse files
author
Cari Spruiell
authored
Merge pull request #168 from magento/1.0.0-release
Sync develop with release branch
2 parents 073020f + 22044ab commit 84225c6

File tree

195 files changed

+4614
-4363
lines changed

Some content is hidden

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

195 files changed

+4614
-4363
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@
44
**.d.js
55
/dev/tests/acceptance/vendor
66
static-error-log.xml
7+
.DS_Store
8+
.vscode

CONTRIBUTING.md

Lines changed: 6 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,5 @@
11
# Contributing to Magento 2 code
22

3-
<!--{% comment %}-->
4-
## Navigation
5-
6-
1. [Introduction]
7-
2. [Installation guide]
8-
3. **Contribution guide**
9-
1. [Overview](#overview)
10-
1. [Contribution requirements](#contribution-requirements)
11-
1. [Contribution process](#contribution-process)
12-
1. [Code of Conduct](#code-of-conduct)
13-
4. [Developer documentation]
14-
5. [Roadmap and known issues]
15-
6. [How to create custom PageBuilder content type container]
16-
17-
[Introduction]: docs/introduction.md
18-
[Installation guide]: docs/install.md
19-
[Developer documentation]: docs/developer-documentation.md
20-
[Roadmap and Known Issues]: docs/roadmap.md
21-
[How to create custom PageBuilder content type container]: docs/how-to-create-custom-content-type-container.md
22-
<!--{% endcomment %}-->
23-
24-
<!-- {% raw %} -->
253
## Overview
264

275
Contributions to the Magento 2 codebase are done using the fork & pull model.
@@ -31,25 +9,23 @@ Contributions can take the form of new components/features, changes to existing
319

3210
The Magento 2 development team will review all issues and contributions submitted by the community of developers in the first in, first out order. During the review we might require clarifications from the contributor. If there is no response from the contributor for two weeks, the issue is closed.
3311

34-
3512
## Contribution requirements
3613

3714
1. Contributions must adhere to [Magento coding standards](http://devdocs.magento.com/guides/v2.0/coding-standards/bk-coding-standards.html).
3815
2. Pull requests (PRs) must be accompanied by a meaningful description of their purpose. Comprehensive descriptions increase the chances of a pull request to be merged quickly and without additional clarification requests.
3916
3. Commits must be accompanied by meaningful commit messages.
4017
4. PRs which include bug fixing, must be accompanied with step-by-step description of how to reproduce the bug.
41-
3. PRs which include new logic or new features must be submitted along with:
42-
* Unit/integration test coverage where applicable.
43-
* Updated documentation in the module directory `app/code/PageBuilder/docs`.
44-
4. For large features or changes, please [open an issue](https://github.com/magento/magento2/issues) and discuss first. This may prevent duplicate or unnecessary effort, and it may gain you some additional contributors.
45-
5. All automated tests are passed successfully locally. After PR submitted Magento team will run builds on continuous integration environment.
18+
5. PRs which include new logic or new features must be submitted along with:
19+
* Unit/integration test coverage where applicable.
20+
* Updated documentation in the `docs` directory at the root level.
21+
6. For large features or changes, please [open an issue](https://github.com/magento/magento2/issues) and discuss first. This may prevent duplicate or unnecessary effort, and it may gain you some additional contributors.
22+
7. All automated tests are passed successfully locally. After PR submitted Magento team will run builds on continuous integration environment.
4623

4724
## Contribution process
4825

4926
If you are a new GitHub user, we recommend that you create your own [free github account](https://github.com/signup/free). By doing that, you will be able to collaborate with the Magento 2 development team, “fork” the Magento 2 project and be able to easily send “pull requests”.
5027

51-
1. Search current [listed issues](https://github.com/magento/magento2-page-builder/issues) on GitHub (open or closed) and [list of known issues](docs/roadmap.md#Known Issues) on our roadmap for similar proposals of intended contribution before starting work on a new contribution.
52-
2. Please contact us in Slack chanel if you want to work on issue from [list of known issues](docs/roadmap.md#Known Issues).
28+
1. Search current [listed issues](https://github.com/magento/magento2-page-builder/issues) on GitHub (open or closed) before starting work on a new contribution.
5329
2. Review the [Contributor License Agreement](https://magento.com/legaldocuments/mca) if this is your first time contributing.
5430
3. Create and test your work.
5531
4. Fork the Magento 2 repository according to [Fork a repository instructions](http://devdocs.magento.com/guides/v2.0/contributor-guide/contributing.html#fork) and when you are ready to send us a pull request – follow [Create a pull request instructions](http://devdocs.magento.com/guides/v2.0/contributor-guide/contributing.html#pull_request). Instructions written for `https://github.com/magento/magento2` repository, but they also apply to `https://github.com/magento/magento2-page-builder`.
@@ -59,5 +35,3 @@ If you are a new GitHub user, we recommend that you create your own [free github
5935

6036
Please note that this project is released with a Contributor Code of Conduct. We expect you to agree to its terms when participating in this project.
6137
The full text is available in the repository [Wiki](https://github.com/magento/magento2/wiki/Magento-Code-of-Conduct).
62-
63-
<!-- {% endraw %} -->

README.md

Lines changed: 48 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -9,72 +9,77 @@ The PageBuilder Early Access Program (EAP) gives partners the following perks:
99
* Explore PageBuilder extension points to build custom modules and integrations for 3rd party services, such as Facebook, Instagram, etc.
1010
* Try out PageBuilder customization options and extend its functionality beyond its default features.
1111
* Preview PageBuilder to prepare a migration plan from BlueFoot 1.0 to PageBuilder.
12-
12+
1313
**Note:**
1414
*This program should not be used to design and launch a production website using early code.*
1515

1616
## Installation
1717

1818
We offer one method for installing PageBuilder:
1919

20+
* As a [Composer package] - use this option if you do not plan to contribute to the PageBuilder code repository.
21+
* Using the [GitHub repository] - use this option to install PageBuilder from the GitHub repository and contribute to the code.
2022

21-
* Using the [GitHub repository] - use this option to install PageBuilder from the GitHub repository and contribute to the code
23+
[Composer package]: docs/install-pagebuilder.md#composer-installation
24+
[GitHub repository]: docs/install-pagebuilder.md#github-installation
2225

23-
[Composer package]: docs/install.md#composer-installation
24-
[GitHub repository]: docs/install.md#github-installation
26+
<!-- {% comment %} -->
2527

2628
## Developer documentation
2729

28-
This project repository contains PageBuilder developer documentation on the following topics:
29-
30-
1. [Architecture overview]
31-
1. [BlueFoot to PageBuilder data migration]
32-
1. [Third-party content type migration]
33-
1. [Iconography]
34-
1. [Module integration]
35-
1. [Additional data configuration]
36-
1. [Content type configuration]
37-
1. [How to add a new content type]
38-
1. [Events]
39-
1. [Bindings]
40-
1. [Master format]
41-
1. [Visual select]
42-
1. [Custom Toolbar]
43-
44-
[Architecture overview]: docs/architecture-overview.md
45-
[BlueFoot to PageBuilder data migration]: docs/bluefoot-data-migration.md
46-
[Third-party content type migration]: docs/new-content-type-example.md
47-
[Iconography]: docs/iconography.md
48-
[Module integration]: docs/module-integration.md
49-
[Additional data configuration]: docs/custom-configuration.md
50-
[Content type configuration]: docs/content-type-configuration.md
51-
[How to add a new content type]: docs/how-to-add-new-content-type.md
52-
[Events]: docs/events.md
53-
[Bindings]: docs/bindings.md
54-
[Master format]: docs/master-format.md
55-
[Visual select]: docs/visual-select.md
56-
[Custom Toolbar]: docs/toolbar.md
30+
### Getting Started
5731

58-
## Contribute to PageBuilder
32+
1. [Introduction](docs/getting-started/introduction.md)
33+
2. [Install Page Builder](docs/getting-started/install-pagebuilder.md)
34+
3. [Activate Page Builder](docs/getting-started/activate-pagebuilder.md)
35+
36+
### Customizations
37+
38+
* [Block chooser](docs/customizations/block-chooser.md)
39+
* [Full-width page layouts](docs/customizations/full-width-page-layouts.md)
40+
* [Responsive layouts](docs/customizations/responsive-layouts.md)
41+
* [Storefront customization](docs/customizations/storefront-customization.md)
42+
* [Visual selects](docs/customizations/visual-selects.md)
43+
* [Additional data configuration](docs/customizations/additional-data-configuration.md)
44+
* [Product conditions](docs/customizations/product-conditions.md)
45+
* [Server-side rendered previews](docs/customizations/server-side-rendered-previews.md)
46+
47+
### How Tos
48+
49+
* [How to develop a new content type](docs/how-to/how-to-develop-new-content-type.md)
50+
* [How to develop a container content type](docs/how-to/how-to-develop-container-content-type.md)
51+
* [How to use the Image Uploader](docs/how-to/how-to-use-image-uploader.md)
52+
* [How to add inline text editing](docs/how-to/how-to-add-inline-text-editing.md)
53+
* [How to add a custom toolbar](docs/how-to/how-to-add-custom-toolbar.md)
54+
* [How to convert product attribute fields to use Page Builder](docs/how-to/how-to-convert-product-attributes-to-use-pagebuilder.md)
55+
* [How to store a component master format as a widget-directive](docs/how-to/how-to-store-master-format-as-widget-directive.md)
56+
57+
### Reference
5958

60-
We appreciate any and all contributions to PageBuilder.
61-
A good place to start is by looking at our [features roadmap] and list of [known issues].
59+
* [Architecture](docs/reference/architecture.md)
60+
* [Events](docs/reference/events.md)
61+
* [Knockout bindings](docs/reference/knockout-bindings.md)
62+
* [Configuration](docs/reference/configuration.md)
63+
* [Master format](docs/reference/master-format.md)
6264

63-
If you are interested in contributing to this repository, please see our [Contribution Guide].
65+
### Migration
66+
67+
* [Migrate from BlueFoot](docs/migration/migrate-from-bluefoot.md)
68+
* [Migrate custom content types from BlueFoot](docs/migration/migrate-custom-content-types-from-bluefoot.md)
69+
70+
<!-- {% endcomment %} -->
71+
72+
## Contribute to PageBuilder
73+
74+
We appreciate any and all contributions to PageBuilder. If you are interested in contributing to this repository, please see our [Contribution Guide].
6475

6576
[Contribution Guide]: CONTRIBUTING.md
66-
[features roadmap]: docs/roadmap.md#planned-features-and-functionality
67-
[known issues]: docs/roadmap.md#known-issues
6877

6978
## PageBuilder updates from the Magento core team
7079

7180
The PageBuilder team updates the code every 2 weeks.
7281
**These changes may introduce breaking changes.**
7382

74-
To help you prepare for these changes, we are publishing a [roadmap] of features and issues that we are going to work on in the following months.
75-
76-
[roadmap]: docs/roadmap.md
77-
7883
## Provide feedback
7984

8085
We want to hear what you think of PageBuilder!

app/code/Magento/PageBuilder/Controller/Adminhtml/ContentType/Image/Upload.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
*/
66
namespace Magento\PageBuilder\Controller\Adminhtml\ContentType\Image;
77

8-
use Magento\Framework\Controller\ResultFactory;
8+
use Magento\Framework\App\Action\HttpPostActionInterface;
99

1010
/**
1111
* Class Upload
1212
*/
13-
class Upload extends \Magento\Backend\App\Action
13+
class Upload extends \Magento\Backend\App\Action implements HttpPostActionInterface
1414
{
1515
const UPLOAD_DIR = 'wysiwyg';
1616

@@ -94,7 +94,12 @@ public function execute()
9494
$fileUploader->setAllowRenameFiles(true);
9595
$fileUploader->setAllowedExtensions(['jpeg','jpg','png','gif']);
9696
$fileUploader->setAllowCreateFolders(true);
97+
9798
try {
99+
if (!$fileUploader->checkMimeType(['image/png', 'image/jpeg', 'image/gif'])) {
100+
throw new \Magento\Framework\Exception\LocalizedException(__('File validation failed.'));
101+
}
102+
98103
$result = $fileUploader->save($this->getUploadDir());
99104
$baseUrl = $this->storeManager->getStore()->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA);
100105
$result['id'] = $this->cmsWysiwygImages->idEncode($result['file']);

app/code/Magento/PageBuilder/Model/Stage/Config/UiComponentConfig.php

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
use Magento\Framework\Config\DataInterfaceFactory;
1111
use Magento\Ui\Config\Converter;
1212

13+
/**
14+
* Retrieve fields and default values from associated UI component forms for content types
15+
*/
1316
class UiComponentConfig
1417
{
1518
/**
@@ -31,7 +34,7 @@ public function __construct(
3134
/**
3235
* Retrieve fields for UI Component
3336
*
34-
* @param $componentName
37+
* @param string $componentName
3538
*
3639
* @return array
3740
*/
@@ -61,32 +64,11 @@ function ($item, $key) {
6164
return $fields;
6265
}
6366

64-
/**
65-
* Retrieve buttons associated with a UI component
66-
*
67-
* @param $componentName
68-
*
69-
* @return array
70-
*/
71-
public function getButtons($componentName) : array
72-
{
73-
$componentConfig = $this->configFactory->create(
74-
['componentName' => $componentName]
75-
)->get($componentName);
76-
77-
// Does the component have any buttons assigned?
78-
if (isset($componentConfig[Converter::DATA_ARGUMENTS_KEY]['data']['buttons'])) {
79-
return $componentConfig[Converter::DATA_ARGUMENTS_KEY]['data']['buttons'];
80-
}
81-
82-
return [];
83-
}
84-
8567
/**
8668
* Iterate over components within the configuration and run a defined callback function
8769
*
88-
* @param $config
89-
* @param $callback
70+
* @param array $config
71+
* @param \Closure $callback
9072
* @param bool $key
9173
*
9274
* @return array
@@ -96,6 +78,10 @@ private function iterateComponents($config, $callback, $key = false) : array
9678
$values = $callback($config, $key) ?: [];
9779
if (isset($config[Converter::DATA_COMPONENTS_KEY])
9880
&& !empty($config[Converter::DATA_COMPONENTS_KEY])
81+
&& (!isset($config[Converter::DATA_ARGUMENTS_KEY]['data']['config']['componentType'])
82+
|| isset($config[Converter::DATA_ARGUMENTS_KEY]['data']['config']['componentType'])
83+
&& $config[Converter::DATA_ARGUMENTS_KEY]['data']['config']['componentType'] !== 'dynamicRows'
84+
)
9985
) {
10086
foreach ($config[Converter::DATA_COMPONENTS_KEY] as $key => $child) {
10187
$values = array_merge(

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

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,23 @@ public function render(array $itemData, array $additionalData = []) : string
5959
];
6060

6161
$formData = $itemData['formData'] ?? [];
62-
$formData['background_image'] = '';
62+
$backgroundImages = '';
63+
$backgroundImagesAttr = '{}';
64+
6365
if (isset($eavData['background_image'])) {
64-
$formData['background_image'] = $eavData['background_image'];
66+
$backgroundImages = $eavData['background_image'];
6567
} elseif (isset($eavData['image'])) {
66-
$formData['background_image'] = $eavData['image'];
68+
$backgroundImages = $eavData['image'];
69+
}
70+
71+
if ($backgroundImages) {
72+
$backgroundImagesAttr = '{\&quot;'
73+
. 'desktop_image\&quot;:\&quot;'
74+
. '{{media url=wysiwyg'
75+
. $backgroundImages
76+
. '}}\&quot;,\&quot;'
77+
. 'mobile_image\&quot;:\&quot;'
78+
. '{}\&quot;}';
6779
}
6880

6981
$margin = $this->styleExtractor->extractStyle($formData, ['margin']);
@@ -72,8 +84,9 @@ public function render(array $itemData, array $additionalData = []) : string
7284
}
7385

7486
$wrapperDivElementAttributes = [
75-
'data-element' => 'mobile_image',
76-
'class' => 'pagebuilder-slide-wrapper pagebuilder-mobile-only'
87+
'data-element' => 'wrapper',
88+
'data-background-images' => $backgroundImagesAttr,
89+
'class' => 'pagebuilder-slide-wrapper'
7790
];
7891
$style = $this->styleExtractor->extractStyle($formData);
7992
if ($style) {
@@ -122,22 +135,6 @@ public function render(array $itemData, array $additionalData = []) : string
122135
. $buttonElementHtml
123136
. '</div></div></div>';
124137

125-
// non-mobile wrapper div
126-
$wrapperDivElementAttributes['data-element'] = 'desktop_image';
127-
$wrapperDivElementAttributes['class'] = 'pagebuilder-slide-wrapper ' .
128-
'pagebuilder-mobile-hidden';
129-
$rootElementHtml .= '<div'
130-
. $this->printAttributes($wrapperDivElementAttributes)
131-
. '><div'
132-
. $this->printAttributes($overlayDivElementAttributes)
133-
. '><div class="pagebuilder-poster-content">'
134-
. '<div data-element="content"><h3>'
135-
. ($eavData['title'] ?? $eavData['title_tag'] ?? '')
136-
. '</h3>'
137-
. '<div>' . ($eavData['textarea'] ?? '') . '</div></div>'
138-
. $buttonElementHtml
139-
. '</div></div></div>';
140-
141138
$rootElementHtml .= '</div></div>';
142139

143140
return $rootElementHtml;

0 commit comments

Comments
 (0)