-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/develop'
- Loading branch information
Showing
37 changed files
with
1,470 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
118 changes: 118 additions & 0 deletions
118
Block/Adminhtml/Config/Validate/InternationalAddressValidation.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
<?php | ||
/** | ||
* | ||
* ..::.. | ||
* ..::::::::::::.. | ||
* ::'''''':''::''''':: | ||
* ::.. ..: : ....:: | ||
* :::: ::: : : :: | ||
* :::: ::: : ''' :: | ||
* ::::..:::..::.....:: | ||
* ''::::::::::::'' | ||
* ''::'' | ||
* | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Creative Commons License. | ||
* It is available through the world-wide-web at this URL: | ||
* http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US | ||
* If you are unable to obtain it through the world-wide-web, please send an email | ||
* to [email protected] so we can send you a copy immediately. | ||
* | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade this module to newer | ||
* versions in the future. If you wish to customize this module for your | ||
* needs please contact [email protected] for more information. | ||
* | ||
* @copyright Copyright (c) Total Internet Group B.V. https://tig.nl/copyright | ||
* @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US | ||
*/ | ||
namespace TIG\PostNL\Block\Adminhtml\Config\Validate; | ||
|
||
use Magento\Backend\Block\Template\Context; | ||
use Magento\Backend\Block\Widget\Button; | ||
use Magento\Config\Block\System\Config\Form\Field; | ||
use Magento\Framework\Data\Form\Element\AbstractElement; | ||
use Magento\Framework\Exception\LocalizedException; | ||
use Magento\Framework\View\Helper\SecureHtmlRenderer; | ||
|
||
class InternationalAddressValidation extends Field | ||
{ | ||
/** @var string */ | ||
//@codingStandardsIgnoreLine | ||
protected $_template = 'TIG_PostNL::config/validate/internationalAddressValidation.phtml'; | ||
|
||
/** | ||
* @param Context $context | ||
* @param array $data | ||
* @param SecureHtmlRenderer|null $secureRenderer | ||
*/ | ||
public function __construct( | ||
Context $context, | ||
array $data = [], | ||
?SecureHtmlRenderer $secureRenderer = null | ||
) { | ||
parent::__construct($context, $data, $secureRenderer); | ||
} | ||
|
||
/** | ||
* Remove scope label | ||
* | ||
* @param AbstractElement $element | ||
* @return string | ||
*/ | ||
public function render(AbstractElement $element) | ||
{ | ||
$element->unsScope(); | ||
$element->unsCanUseWebsiteValue(); | ||
$element->unsCanUseDefaultValue(); | ||
|
||
return parent::render($element); | ||
} | ||
|
||
/** | ||
* Return element html | ||
* | ||
* @param AbstractElement $element | ||
* @return string | ||
*/ | ||
//@codingStandardsIgnoreLine | ||
protected function _getElementHtml(AbstractElement $element) | ||
{ | ||
return $this->_toHtml(); | ||
} | ||
|
||
/** | ||
* Return ajax url for collect button | ||
* | ||
* @return string | ||
*/ | ||
public function getAjaxUrl() | ||
{ | ||
return $this->getUrl('postnl/config_validate/internationalAddressValidation'); | ||
} | ||
|
||
/** | ||
* Generate collect button html | ||
* | ||
* @return string | ||
* | ||
* @throws LocalizedException | ||
*/ | ||
public function getButtonHtml() | ||
{ | ||
$layout = $this->getLayout(); | ||
$buttonBlock = $layout->createBlock(Button::class); | ||
$buttonBlock->setData( | ||
[ | ||
'id' => 'validate_international_address_check', | ||
//@codingStandardsIgnoreLine | ||
'label' => __('Validate International Address Check'), | ||
] | ||
); | ||
|
||
return $buttonBlock->toHtml(); | ||
} | ||
} |
61 changes: 61 additions & 0 deletions
61
Config/CheckoutConfiguration/IsInternationalAddressActive.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?php | ||
/** | ||
* | ||
* ..::.. | ||
* ..::::::::::::.. | ||
* ::'''''':''::''''':: | ||
* ::.. ..: : ....:: | ||
* :::: ::: : : :: | ||
* :::: ::: : ''' :: | ||
* ::::..:::..::.....:: | ||
* ''::::::::::::'' | ||
* ''::'' | ||
* | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Creative Commons License. | ||
* It is available through the world-wide-web at this URL: | ||
* http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US | ||
* If you are unable to obtain it through the world-wide-web, please send an email | ||
* to [email protected] so we can send you a copy immediately. | ||
* | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade this module to newer | ||
* versions in the future. If you wish to customize this module for your | ||
* needs please contact [email protected] for more information. | ||
* | ||
* @copyright Copyright (c) Total Internet Group B.V. https://tig.nl/copyright | ||
* @license http://creativecommons.org/licenses/by-nc-nd/3.0/nl/deed.en_US | ||
*/ | ||
namespace TIG\PostNL\Config\CheckoutConfiguration; | ||
|
||
use TIG\PostNL\Config\Provider\Webshop; | ||
|
||
class IsInternationalAddressActive implements CheckoutConfigurationInterface | ||
{ | ||
/** | ||
* @var Webshop | ||
*/ | ||
private $webshopConfig; | ||
|
||
/** | ||
* IsInternationalAddressActive constructor | ||
* | ||
* @param Webshop $webshop | ||
*/ | ||
public function __construct( | ||
Webshop $webshop | ||
) { | ||
$this->webshopConfig = $webshop; | ||
} | ||
|
||
/** | ||
* @return bool | ||
*/ | ||
public function getValue() | ||
{ | ||
return (bool) $this->webshopConfig->getIsInternationalAddressEnabled() && $this->webshopConfig->getIsAddressCheckEnabled(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.