Skip to content

[Backport] Add class into image builder #18864

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

Closed

Conversation

gelanivishal
Copy link
Contributor

@gelanivishal gelanivishal commented Oct 27, 2018

Original PR

#18388

Description

Currently, the product image has an hardcoded class product-image-photo which can't be overriden when using the $attributes parameter of the imageBuilder->create() function.

Manual testing scenarios

  1. Display a product image using
$block->getImage($product, $image, ['class' => 'my-custom-class'])->toHtml();

=> The img tag has my-custom-class as class.

  1. Display a product image using
$block->getImage($product, $image)->toHtml();

=> The img tag has product-image-photo as class.

The aim here is to allow customization without breaking the default value.

I'm open to discussion about how to deal with this!

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)

@magento-engcom-team
Copy link
Contributor

Hi @gelanivishal. 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 $VERSION instance - deploy vanilla Magento instance

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

@sidolov
Copy link
Contributor

sidolov commented Oct 31, 2018

Hi @gelanivishal , changes in original PR are completely different and can't be ported automatically.
Please, adopt changes for corresponded version.

@gelanivishal
Copy link
Contributor Author

@sidolov Please check now.

@@ -0,0 +1,179 @@
<?php
Copy link
Contributor

Choose a reason for hiding this comment

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

It's not a good idea to port the whole class and use only one method. Please, consider to provide different implementation compatible with 2.2-develop.

Copy link
Contributor

Choose a reason for hiding this comment

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

Disagree with that. @sidolov why we need to reinvent the wheel?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure if this new class is actually used though.

Copy link
Contributor

Choose a reason for hiding this comment

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

@orlangur I agree that we shouldn't implement completely new solution, but introducing code that never used not a good idea. We should port only the fragments that resolves the problem

Copy link
Contributor

Choose a reason for hiding this comment

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

@sidolov but it requires more efforts and make codebase 2.2/2.3 less consistent. I see your point but as for me some unused code is lesser evil.

Copy link
Contributor

Choose a reason for hiding this comment

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

@orlangur it's pretty simple, for 2.2 we need just one method from 2.3 version. We trying to introduce new code that will be marked as unused and deprecated

@@ -1,319 +0,0 @@
<?php
Copy link
Contributor

Choose a reason for hiding this comment

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

We can't remove attribute repository according to our Backward Compatible Development Guide

@orlangur orlangur self-assigned this Nov 7, 2018
@@ -1,212 +0,0 @@
<?php
Copy link
Contributor

Choose a reason for hiding this comment

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

No, you cannot just remove a test.

@orlangur
Copy link
Contributor

Closing due to inactivity. Feel free to reach me out anytime later if you wish to continue work on this pull request and it will be reopened.
Thanks for collaboration!

@orlangur orlangur closed this Nov 19, 2018
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.

5 participants