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
56
57
58
59
60
61
62
63
64
65
66
<?php
/**
* Copyright © 2016 Ihor Vansach (ihor@magefan.com). All rights reserved.
* See LICENSE.txt for license details (http://opensource.org/licenses/osl-3.0.php).
*
* Glory to Ukraine! Glory to the heroes!
*/
namespace Magefan\Blog\Block\Adminhtml\Import;
use Magento\Store\Model\ScopeInterface;
/**
* Wordpress import block
*/
class Wordpress extends \Magento\Backend\Block\Widget\Form\Container
{
/**
* Initialize wordpress import block
*
* @return void
*/
protected function _construct()
{
$this->_objectId = 'id';
$this->_blockGroup = 'Magefan_Blog';
$this->_controller = 'adminhtml_import';
$this->_mode = 'wordpress';
parent::_construct();
if (!$this->_isAllowedAction('Magefan_Blog::import')) {
$this->buttonList->remove('save');
} else {
$this->updateButton(
'save', 'label', __('Start Import')
);
}
$this->buttonList->remove('delete');
}
/**
* Check permission for passed action
*
* @param string $resourceId
* @return bool
*/
protected function _isAllowedAction($resourceId)
{
return $this->_authorization->isAllowed($resourceId);
}
/**
* Get form save URL
*
* @see getFormActionUrl()
* @return string
*/
public function getSaveUrl()
{
return $this->getUrl('*/*/run', ['_current' => true]);
}
}