magento2
magento2 copied to clipboard
Fix customer widgets to use proper formatters
Description (*)
Many of the customer widgets does not process the id nor the name formatter if given. This MR aims to fix it by using the methods getFieldName and getFieldId which are declared within the parent class \Magento\Customer\Block\Widget\AbstractWidget.
/**
* @return string
*/
public function getFieldIdFormat()
{
if (!$this->hasData('field_id_format')) {
$this->setData('field_id_format', '%s');
}
return $this->getData('field_id_format');
}
/**
* @return string
*/
public function getFieldNameFormat()
{
if (!$this->hasData('field_name_format')) {
$this->setData('field_name_format', '%s');
}
return $this->getData('field_name_format');
}
/**
* @param string $field
* @return string
*/
public function getFieldId($field)
{
return sprintf($this->getFieldIdFormat(), $field);
}
/**
* @param string $field
* @return string
*/
public function getFieldName($field)
{
return sprintf($this->getFieldNameFormat(), $field);
}
Related Pull Requests
Fixed Issues (if relevant)
- Fixes magento/magento2#<issue_number>
Manual testing scenarios (*)
- ...
- ...
Questions or comments
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)
- [ ] README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
- [ ] All automated tests passed successfully (all builds are green)
Resolved issues:
- [x] resolves magento/magento2#38768: Fix customer widgets to use proper formatters
Hi @thomas-kl1. Thank you for your contribution! Here are some useful tips on 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 give me test instance- deploy test instance based on PR changes@magento give me 2.4-develop instance- deploy vanilla Magento instance
:exclamation: Automated tests can be triggered manually with an appropriate comment:
@magento run all tests- run or re-run all required tests against the PR changes@magento run <test-build(s)>- run or re-run specific test build(s) For example:@magento run Unit Tests
<test-build(s)> is a comma-separated list of build names.
Allowed build names are:
Database CompareFunctional Tests CEFunctional Tests EEFunctional Tests B2BIntegration TestsMagento Health IndexSample Data Tests CESample Data Tests EESample Data Tests B2BStatic TestsUnit TestsWebAPI TestsSemantic Version Checker
You can find more information about the builds here :information_source: Run only required test builds during development. Run all test builds before sending your pull request for review.
For more details, review the Code Contributions documentation. Join Magento Community Engineering Slack and ask your questions in #github channel.
@magento run all tests
Errors in report are not related to the current changes. Static analysis errors are not relevant regarding the changes.
@magento create issue