-
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.
- Loading branch information
Showing
86 changed files
with
4,087 additions
and
273 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?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\Comment; | ||
|
||
use Magento\Framework\Data\Form\Element\Renderer\RendererInterface; | ||
use Magento\Framework\View\Element\Template; | ||
|
||
class IdCheck extends Template implements RendererInterface | ||
{ | ||
// @codingStandardsIgnoreLine | ||
protected $_template = 'TIG_PostNL::config/comment/idCheck.phtml'; | ||
|
||
/** | ||
* Render form element as HTML | ||
* | ||
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element | ||
* | ||
* @return string | ||
*/ | ||
public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element) | ||
{ | ||
/** @noinspection PhpUndefinedMethodInspection */ | ||
$this->setElement($element); | ||
|
||
return $this->toHtml(); | ||
} | ||
} |
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,79 @@ | ||
<?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\Form\Field; | ||
|
||
use \Magento\Config\Block\System\Config\Form\Field as MagentoField; | ||
use \Magento\Framework\Data\Form\Element\AbstractElement; | ||
|
||
class Color extends MagentoField | ||
{ | ||
/** | ||
* @param AbstractElement $element | ||
* | ||
* @return string | ||
*/ | ||
// @codingStandardsIgnoreLine | ||
protected function _getElementHtml(AbstractElement $element) | ||
{ | ||
$html = $element->getElementHtml(); | ||
$value = $element->getData('value'); | ||
$html .= $this->addColorPickerToHtml($element, $value); | ||
|
||
return $html; | ||
} | ||
|
||
/** | ||
* @param AbstractElement $element | ||
* @param $value | ||
* | ||
* @return string | ||
*/ | ||
private function addColorPickerToHtml(AbstractElement $element, $value) | ||
{ | ||
// @codingStandardsIgnoreStart | ||
return '<script type="text/javascript"> | ||
require(["jquery","jquery/colorpicker/js/colorpicker"], function ($) { | ||
$(document).ready(function () { | ||
var $el = $("#' . $element->getHtmlId() . '"); | ||
$el.css("backgroundColor", "'. $value .'"); | ||
$el.ColorPicker({ | ||
color: "'. $value .'", | ||
onChange: function (hsb, hex, rgb) { | ||
$el.css("backgroundColor", "#" + hex).val("#" + hex); | ||
} | ||
}); | ||
}); | ||
}); | ||
</script>'; | ||
// @codingStandardsIgnoreEnd | ||
} | ||
} |
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\Grid; | ||
|
||
use Magento\Backend\Block\Template; | ||
use Magento\Framework\View\Element\BlockInterface; | ||
use Magento\Framework\App\DeploymentConfig\Reader; | ||
use TIG\PostNL\Config\Source\Options\ProductOptions; | ||
use TIG\PostNL\Config\Provider\ProductOptions as OptionConfig; | ||
|
||
class DataProvider extends Template implements BlockInterface | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
// @codingStandardsIgnoreLine | ||
protected $_template = 'TIG_PostNL::grid/DataProvider.phtml'; | ||
|
||
/** | ||
* @var Reader | ||
*/ | ||
private $configReader; | ||
|
||
/** | ||
* @var ProductOptions | ||
*/ | ||
private $productOptions; | ||
|
||
/** | ||
* @var OptionConfig | ||
*/ | ||
private $optionConfig; | ||
|
||
/** | ||
* DataProvider constructor. | ||
* | ||
* @param Template\Context $context | ||
* @param Reader $reader | ||
* @param ProductOptions $productOptions | ||
* @param OptionConfig $optionConfig | ||
* @param array $data | ||
*/ | ||
public function __construct( | ||
Template\Context $context, | ||
Reader $reader, | ||
ProductOptions $productOptions, | ||
OptionConfig $optionConfig, | ||
array $data = [] | ||
) { | ||
$this->configReader = $reader; | ||
$this->productOptions = $productOptions; | ||
$this->optionConfig = $optionConfig; | ||
parent::__construct($context, $data); | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getProductOptions() | ||
{ | ||
$this->productOptions->setOptionsBySupportedType(); | ||
$supportedTypes = $this->productOptions->get(); | ||
|
||
$options = []; | ||
foreach ($supportedTypes as $key => $option) { | ||
$options[] = ['value' => (string) $key, 'text' => $option['label']]; | ||
} | ||
|
||
return \Zend_Json::encode($options); | ||
} | ||
|
||
/** | ||
* @return int|string | ||
*/ | ||
public function getDefaultProductOption() | ||
{ | ||
return $this->optionConfig->getDefaultProductOption(); | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getAdminBaseUrl() | ||
{ | ||
$config = $this->configReader->load(); | ||
$adminSuffix = $config['backend']['frontName']; | ||
return $this->getBaseUrl() . $adminSuffix . '/'; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?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\Comment; | ||
|
||
use Magento\Config\Model\Config\CommentInterface; | ||
use TIG\PostNL\Block\Adminhtml\Config\Comment\IdCheck as Block; | ||
|
||
class IdCheck implements CommentInterface | ||
{ | ||
/** | ||
* @var Block | ||
*/ | ||
private $block; | ||
|
||
/** | ||
* @param Block $block | ||
*/ | ||
public function __construct( | ||
Block $block | ||
) { | ||
$this->block = $block; | ||
} | ||
|
||
/** | ||
* Retrieve element comment by element value | ||
* | ||
* @param string $elementValue | ||
* | ||
* @return string | ||
*/ | ||
// @codingStandardsIgnoreLine | ||
public function getCommentText($elementValue) | ||
{ | ||
return $this->block->toHtml(); | ||
} | ||
} |
Oops, something went wrong.