Skip to content

Fix broken widget placeholders after upgrading from 2.2 #19987

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

vovayatsyuk
Copy link
Member

Affects backend editor when WYSIWYG is enabled and widget declarations are from Magento < 2.3.

Description (*)

This PR makes two things:

  1. Makes visible widget placeholder when type_name is not available in widget declaration
  2. Makes visible widget name when type_name is not available in widget declaration

Manual testing scenarios (*)

  1. Navigate to Content > Pages and create a new page

  2. Disable WYSIWYG editor

  3. Fill content field with following value (It's a widget code from Magento < 2.3):

    <div>{{widget type="Magento\CatalogWidget\Block\Product\ProductsList" show_pager="0" products_count="10" template="Magento_CatalogWidget::product/widget/content/grid.phtml" }}</div>
    
  4. Enable WYSIWYG editor

  5. You will see an error icon instead of widget image

Without patch With patch
image image

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

This commit fixes widget previews for widgets inserted in Magento < 2.3,
when 'type_name' property doesn't exist
This commit makes cleaner widget code. Widget name can be taken from
plugin options by 'type' property
@magento-engcom-team
Copy link
Contributor

Hi @vovayatsyuk. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento-engcom-team give me test instance - deploy test instance based on PR changes
  • @magento-engcom-team give me 2.3-develop instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Assistant documentation

Copy link
Contributor

@orlangur orlangur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vovayatsyuk old widget declarations should be migrated automatically during upgrade, isn't it?

@vovayatsyuk
Copy link
Member Author

@orlangur oops, didn't test it, I just copy-paste a widget from third-party instructions :)

However, I still think that the code introduced in 2.3 should be improved to be compatible with 2.2 when it's possible.

Additionally, adding a new internal property ("type_name") is not a good solution because it doesn't work well for multiple backend users with different locales.

p.s. We already have a "type" in widget declaration and it's enough to do the rest of work, why pollute widget declaration with new variables?

@vovayatsyuk
Copy link
Member Author

Just checked updated store (2.2 to 2.3). Standard widget wasn't updated in store homepage:

{{widget type="Magento\Catalog\Block\Product\Widget\NewWidget" display_type="new_products" products_count="8" template="product/widget/new/content/new_grid.phtml"}}

@orlangur
Copy link
Contributor

Considering e4f6d5b#diff-7f5941d4c18c5f77dbccea6c32c5e6b5, @danmooney2 @irenelagno could you please evaluate this suggestion?

@orlangur
Copy link
Contributor

Ping @danmooney2 @irenelagno.

@melnikovi would appreciate your help as you seem to own Widget module.

@danmooney2
Copy link
Contributor

This looks fine. Ideally type_name should be retained as a fallback for the sake of providing feedback when a type is uninstalled, skipped, etc.

@magento-engcom-team
Copy link
Contributor

Hi @orlangur, thank you for the review.
ENGCOM-4584 has been created to process this Pull Request

@VasylShvorak
Copy link
Contributor

✔️ QA passed

@ghost ghost added the Progress: accept label Apr 3, 2019
@magento-engcom-team magento-engcom-team merged commit 785d826 into magento:2.3-develop Apr 8, 2019
@m2-assistant
Copy link

m2-assistant bot commented Apr 8, 2019

Hi @vovayatsyuk, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants