-
-
Notifications
You must be signed in to change notification settings - Fork 73
/
Copy pathGenericButton.php
executable file
·55 lines (48 loc) · 1.3 KB
/
GenericButton.php
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
53
54
55
<?php
namespace EthanYehuda\CronjobManager\Block\Adminhtml\Cronjob\Edit;
use EthanYehuda\CronjobManager\Model\RegistryConstants;
class GenericButton
{
/**
* Url Builder
*
* @var \Magento\Framework\UrlInterface
*/
protected $urlBuilder;
/**
* Registry
*
* @var \Magento\Framework\Registry
*/
protected $registry;
/**
* Constructor
*
* @param \Magento\Backend\Block\Widget\Context $context
* @param \Magento\Framework\Registry $registry
*/
public function __construct(
\Magento\Backend\Block\Widget\Context $context,
\Magento\Framework\Registry $registry
) {
$this->urlBuilder = $context->getUrlBuilder();
$this->registry = $registry;
}
public function getRequestParams()
{
return $this->registry->registry(RegistryConstants::CURRENT_CRON_JOB) ?
$this->registry->registry(RegistryConstants::CURRENT_CRON_JOB) :
$this->registry->registry(RegistryConstants::CURRENT_CRON_CONFIG);
}
/**
* Generate url by route and parameters
*
* @param string $route
* @param array $params
* @return string
*/
public function getUrl($route = '', $params = [])
{
return $this->urlBuilder->getUrl($route, $params);
}
}