1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
namespace Dotdigitalgroup\Email\Block\Adminhtml\Config\Developer;
class Resetreviews extends \Magento\Config\Block\System\Config\Form\Field
{
/**
* @var string
*/
public $buttonLabel = 'Run Now';
/**
* @param string $buttonLabel
*
* @return $this
*/
public function setButtonLabel($buttonLabel)
{
$this->buttonLabel = $buttonLabel;
return $this;
}
/**
* Get the button and scripts contents.
*
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
*
* @return string
*/
public function _getElementHtml(\Magento\Framework\Data\Form\Element\AbstractElement $element)
{
$query = [
'_query' => [
'from' => '',
'to' => '',
'tp' => ''
]
];
$url = $this->_urlBuilder->getUrl('dotdigitalgroup_email/run/reviewsreset', $query);
return $this->getLayout()->createBlock(
\Magento\Backend\Block\Widget\Button::class
)
->setType('button')
->setLabel($this->buttonLabel)
->setId($element->getId())
->setOnClick("window.location.href='" . $url . "'")
->toHtml();
}
}