WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Conversation

@lcouget
Copy link

@lcouget lcouget commented Nov 16, 2023

Added "New version update available" message notice on Amazon Payment settings.

/**
* @return string
*/
protected function renderUpdateNotification(): string

Choose a reason for hiding this comment

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

An improvement could be here made by separating the HTML rendering to a separate block class/view model with .phtml template.
$updateNotificationBlock = $this->layout->createBlock(<block_path>); return $updateNotificationBlock->toHtml();
where the template path is set in the constructor or as an overridden property in the block class.

return $html;
}

protected function _getHeaderTitleHtml($element): string

Choose a reason for hiding this comment

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

Also could be a separate block for rendering the html

/**
* module JSON url
*/
const URL = 'https://repo.packagist.org/p2/amzn/amazon-pay-magento-2-module.json';

Choose a reason for hiding this comment

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

Maybe not an improvement, but a neat alternative. You can move this hard coded value to xml configuration.
private string $repoSource; public function __construct(string $repoSource = '') { $this->repoSource = $repoSource; }
di.xml
<type name="<class>"> <arguments> <argument name="repoSource" xsi:type="string">https://repo.packagist.org/p2/amzn/amazon-pay-magento-2-module.json</argument> </arguments> </type>

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants