|
Apache/2.4.41 (Ubuntu) Linux vmi616275.contaboserver.net 5.4.0-84-generic #94-Ubuntu SMP Thu Aug 26 20:27:37 UTC 2021 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) server ip : 62.171.164.128 | your ip : 127.0.0.1 safemode OFF > / home / dev2.destoffenstraat.com / app / code / WeSupply / Toolbox / Block / System / Config / |
Filename | /home/dev2.destoffenstraat.com/app/code/WeSupply/Toolbox/Block/System/Config/CredentialsCheck.php |
Size | 1.69 kb |
Permission | rwxrwxrwx |
Owner | root : root |
Create time | 17-Aug-2025 10:26 |
Last modified | 17-May-2021 07:16 |
Last accessed | 22-Aug-2025 21:45 |
Actions | edit | rename | delete | download (gzip) |
View | text | code | image |
<?php
namespace WeSupply\Toolbox\Block\System\Config;
use Magento\Backend\Block\Template\Context;
use Magento\Config\Block\System\Config\Form\Field;
use Magento\Framework\Data\Form\Element\AbstractElement;
class CredentialsCheck extends Field
{
/**
* @var string
*/
protected $_template = 'WeSupply_Toolbox::system/config/credentialscheck.phtml';
/**
* @param Context $context
* @param array $data
*/
public function __construct(
Context $context,
array $data = []
) {
parent::__construct($context, $data);
}
/**
* Remove scope label
*
* @param AbstractElement $element
* @return string
*/
public function render(AbstractElement $element)
{
$element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
return parent::render($element);
}
/**
* Return element html
*
* @param AbstractElement $element
* @return string
*/
protected function _getElementHtml(AbstractElement $element)
{
return $this->_toHtml();
}
/**
* Return ajax url for test connection button
*
* @return string
*/
public function getAjaxUrl()
{
return $this->getUrl('wesupply/system_config/testconnection');
}
/**
* Generate collect button html
*
* @return string
*/
public function getButtonHtml()
{
$button = $this->getLayout()->createBlock(
'Magento\Backend\Block\Widget\Button'
)->setData(
[
'id' => 'test_credentials',
'label' => __('Test'),
]
);
return $button->toHtml();
}
}
namespace WeSupply\Toolbox\Block\System\Config;
use Magento\Backend\Block\Template\Context;
use Magento\Config\Block\System\Config\Form\Field;
use Magento\Framework\Data\Form\Element\AbstractElement;
class CredentialsCheck extends Field
{
/**
* @var string
*/
protected $_template = 'WeSupply_Toolbox::system/config/credentialscheck.phtml';
/**
* @param Context $context
* @param array $data
*/
public function __construct(
Context $context,
array $data = []
) {
parent::__construct($context, $data);
}
/**
* Remove scope label
*
* @param AbstractElement $element
* @return string
*/
public function render(AbstractElement $element)
{
$element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
return parent::render($element);
}
/**
* Return element html
*
* @param AbstractElement $element
* @return string
*/
protected function _getElementHtml(AbstractElement $element)
{
return $this->_toHtml();
}
/**
* Return ajax url for test connection button
*
* @return string
*/
public function getAjaxUrl()
{
return $this->getUrl('wesupply/system_config/testconnection');
}
/**
* Generate collect button html
*
* @return string
*/
public function getButtonHtml()
{
$button = $this->getLayout()->createBlock(
'Magento\Backend\Block\Widget\Button'
)->setData(
[
'id' => 'test_credentials',
'label' => __('Test'),
]
);
return $button->toHtml();
}
}