|
| 1 | +# Breaking changes in 1.0.0-beta7 |
| 2 | + |
| 3 | +As hard as we tried to avoid breaking changes during our beta program, we felt compelled to clarify certain names within Page Builder to help developers better understand their purpose. As a result these changes **will break** existing content within previous beta versions, along with any custom content types you've created. |
| 4 | + |
| 5 | +A summary of the changes is shown here, followed by the details on how to update your existing content: |
| 6 | + |
| 7 | +- `data-role` to `data-content-type` |
| 8 | +- `group` to `menu_section` |
| 9 | +- `render_template` to `master_template` |
| 10 | +- `is_visible` to `is_system` |
| 11 | +- `renderChildTemplate` to `masterTemplate` |
| 12 | +- `previewChildTemplate` to `childTemplate` |
| 13 | +- `renderTemplate` and `previewTemplate` to `template` |
| 14 | + |
| 15 | +We’re sorry if these changes cause you any disruption. But we strongly believe they will improve product understanding for all future developers. |
| 16 | + |
| 17 | +## Master Format Changes |
| 18 | + |
| 19 | +The `data-role` attribute is now called `data-content-type`. We strongly believe this makes understanding the purpose of the element and attribute much easier, as `data-role` is already used for several other features in Magento. |
| 20 | + |
| 21 | +This change causes existing content to load as HTML code within your content type. To fix this issue, run the following command on your MySQL database: |
| 22 | + |
| 23 | +```sql |
| 24 | +UPDATE cms_page SET content = REPLACE(content, 'data-role="', 'data-content-type="'); |
| 25 | +UPDATE cms_block SET content = REPLACE(content, 'data-role="', 'data-content-type="'); |
| 26 | +UPDATE magento_banner_content SET banner_content = REPLACE(banner_content, 'data-role="', 'data-content-type="'); |
| 27 | +UPDATE catalog_category_entity_text SET value = REPLACE(value, 'data-role="', 'data-content-type="'); |
| 28 | +UPDATE catalog_product_entity_text SET value = REPLACE(value, 'data-role="', 'data-content-type="'); |
| 29 | +``` |
| 30 | + |
| 31 | +## XML Changes |
| 32 | + |
| 33 | +The `group` system has been renamed to `menu_section`, resulting in the following changes: |
| 34 | + |
| 35 | +- The `group.xml`, `group.xsd`, and `group_merged.xsd` files are now called `menu_section.xml`, `menu_section.xsd`, and `menu_section_merged.xsd`, but are located in the same places and have the same purposes. Nodes within these files have also been updated from `<group />` to `<menu_section />`. |
| 36 | + |
| 37 | +- The `group` attribute is now called `menu_section`. If you've implemented a custom content type, you will need to update this attribute within your content type's configuration file. For example: |
| 38 | + |
| 39 | + ```xml |
| 40 | + <type name="example_quote" |
| 41 | + label="Quote" |
| 42 | + menu_section="elements" |
| 43 | + ``` |
| 44 | + |
| 45 | +- For any panel extensions you may have done, you will need to change your panel import references from `Magento_PageBuilder/js/panel/group` to `Magento_PageBuilder/js/panel/menuSections`, as well as any reader class references from `Magento\PageBuilder\Model\Config\Group` classes to `Magento\PageBuilder\Model\Config\MenuSection` classes, as necessary. |
| 46 | + |
| 47 | +## JavaScript Changes |
| 48 | + |
| 49 | +We've also improved the naming of various properties in the JavaScript classes we ship within Page Builder. These changes may result in your custom extensions referencing properties that are no longer available. |
| 50 | +
|
| 51 | +- A content type's parent content type is now referenced as `parentContentType` instead of just `parent`, this was changed in `content-type.ts` and `content-type-collection.ts`. If you're traversing up the tree you will need to update this reference. |
| 52 | +
|
| 53 | +- From the `preview` and `master` components, you now access the content type instance through `contentType` instead of previously using `parent`. For example, event code using `parent` will need to be updated to contentType: |
| 54 | +
|
| 55 | + ```js |
| 56 | + events.on(`${this.config.name}:${this.parent.id}:updateAfter`, function (args) { |
| 57 | + console.log(self.parent); |
| 58 | + }); |
| 59 | + ``` |
| 60 | +
|
| 61 | + Changes to: |
| 62 | +
|
| 63 | + ```js |
| 64 | + events.on(`${this.config.name}:${this.contentType.id}:updateAfter`, function (args) { |
| 65 | + console.log(self.contentType); |
| 66 | + }); |
| 67 | + ``` |
| 68 | +
|
| 69 | +- `render_template` is renamed to `master_template`: |
| 70 | +
|
| 71 | + ```xml |
| 72 | + <appearance name="default" |
| 73 | + preview_template="Example_PageBuilderQuote/content-type/example-quote/default/preview" |
| 74 | + render_template="Example_PageBuilderQuote/content-type/example-quote/default/master" |
| 75 | + reader="Magento_PageBuilder/js/master-format/read/configurable"> |
| 76 | + ``` |
| 77 | +
|
| 78 | + Changes to: |
| 79 | +
|
| 80 | + ```xml |
| 81 | + <appearance name="default" |
| 82 | + preview_template="Example_PageBuilderQuote/content-type/example-quote/default/preview" |
| 83 | + master_template="Example_PageBuilderQuote/content-type/example-quote/default/master" |
| 84 | + reader="Magento_PageBuilder/js/master-format/read/configurable"> |
| 85 | + ``` |
| 86 | +
|
| 87 | + |
| 88 | +
|
| 89 | +- `is_visible` is renamed to `is_system`. If your content type modifies this attribute, you will need to update your reference in the configuration file. |
| 90 | +
|
| 91 | +- `renderChildTemplate` is renamed to `masterTemplate` and `previewChildTemplate` is renamed to `childTemplate`. If you have a container content type which renders children, you will need to update these references in your code. |
0 commit comments