1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the Sylius package. |
5
|
|
|
* |
6
|
|
|
* (c) Paweł Jędrzejewski |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
declare(strict_types=1); |
13
|
|
|
|
14
|
|
|
namespace Sylius\Bundle\GridBundle\Templating\Helper; |
15
|
|
|
|
16
|
|
|
use Sylius\Component\Grid\Definition\Action; |
17
|
|
|
use Sylius\Component\Grid\Definition\Field; |
18
|
|
|
use Sylius\Component\Grid\Definition\Filter; |
19
|
|
|
use Sylius\Component\Grid\Renderer\BulkActionGridRendererInterface; |
20
|
|
|
use Sylius\Component\Grid\Renderer\GridRendererInterface; |
21
|
|
|
use Sylius\Component\Grid\View\GridView; |
22
|
|
|
use Symfony\Component\Templating\Helper\Helper; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @final |
26
|
|
|
*/ |
27
|
|
|
class BulkActionGridHelper extends Helper |
28
|
|
|
{ |
29
|
|
|
/** |
30
|
|
|
* @var BulkActionGridRendererInterface |
31
|
|
|
*/ |
32
|
|
|
private $bulkActionGridRenderer; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @param BulkActionGridRendererInterface $bulkActionGridRenderer |
36
|
|
|
*/ |
37
|
|
|
public function __construct(BulkActionGridRendererInterface $bulkActionGridRenderer) |
38
|
|
|
{ |
39
|
|
|
$this->bulkActionGridRenderer = $bulkActionGridRenderer; |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @param GridView $gridView |
44
|
|
|
* @param Action $bulkAction |
45
|
|
|
* @param mixed|null $data |
46
|
|
|
* |
47
|
|
|
* @return string |
48
|
|
|
*/ |
49
|
|
|
public function renderBulkAction(GridView $gridView, Action $bulkAction, $data = null): string |
50
|
|
|
{ |
51
|
|
|
return $this->bulkActionGridRenderer->renderBulkAction($gridView, $bulkAction, $data); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @return string |
56
|
|
|
*/ |
57
|
|
|
public function getName(): string |
58
|
|
|
{ |
59
|
|
|
return 'sylius_bulk_action_grid'; |
60
|
|
|
} |
61
|
|
|
} |
62
|
|
|
|