1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* @company MTE Telecom, Ltd. |
4
|
|
|
* @author Roman Malashin <[email protected]> |
5
|
|
|
*/ |
6
|
|
|
|
7
|
|
|
namespace Nnx\DataGrid\Column; |
8
|
|
|
|
9
|
|
|
use Zend\ServiceManager\AbstractPluginManager; |
10
|
|
|
use Zend\ServiceManager\Exception; |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* Class ColumnPluginManager |
14
|
|
|
* @package Nnx\DataGrid\Column |
15
|
|
|
*/ |
16
|
|
|
class GridColumnPluginManager extends AbstractPluginManager |
17
|
|
|
{ |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* @var bool |
21
|
|
|
*/ |
22
|
|
|
protected $shareByDefault = false; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @var array |
26
|
|
|
*/ |
27
|
|
|
protected $aliases = [ |
28
|
|
|
'text' => Text::class, |
29
|
|
|
'hidden' => Hidden::class, |
30
|
|
|
'link' => Link::class, |
31
|
|
|
'money' => Money::class, |
32
|
|
|
'radio' => Radio::class, |
33
|
|
|
'checkbox' => Checkbox::class, |
34
|
|
|
'action' => Action::class |
35
|
|
|
]; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @var array |
39
|
|
|
*/ |
40
|
|
|
protected $invokableClasses = [ |
41
|
|
|
|
42
|
|
|
]; |
43
|
|
|
|
44
|
|
|
protected $factories = [ |
45
|
|
|
Action::class => ActionFactory::class, |
46
|
|
|
Text::class => Factory::class, |
47
|
|
|
Hidden::class => Factory::class, |
48
|
|
|
Link::class => Factory::class, |
49
|
|
|
Radio::class => Factory::class, |
50
|
|
|
Checkbox::class => Factory::class, |
51
|
|
|
Money::class => Factory::class |
52
|
|
|
]; |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* Validate the plugin |
56
|
|
|
* |
57
|
|
|
* Checks that the filter loaded is either a valid callback or an instance |
58
|
|
|
* of FilterInterface. |
59
|
|
|
* |
60
|
|
|
* @param mixed $plugin |
61
|
|
|
* @return void |
62
|
|
|
* @throws Exception\RuntimeException if invalid |
63
|
|
|
*/ |
64
|
|
|
public function validatePlugin($plugin) |
65
|
|
|
{ |
66
|
|
|
if ($plugin instanceof ColumnInterface) { |
67
|
|
|
return; |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
throw new Exception\RuntimeException(sprintf('Column должен реализовывать %s', ColumnInterface::class)); |
71
|
|
|
} |
72
|
|
|
} |
|
|
|
|
73
|
|
|
|
This check marks files that end in a newline character, i.e. an empy line.