1 | <?php |
||
7 | class Column implements ColumnInterface |
||
8 | { |
||
9 | const TYPE = 'string'; |
||
10 | |||
11 | /** |
||
12 | * Column field info that might be used client side |
||
13 | * |
||
14 | * https://datatables.net/reference/option/columns |
||
15 | * |
||
16 | * @var array |
||
17 | */ |
||
18 | public static $clientSideColumnOptions = [ |
||
19 | 'cellType','className','contentPadding', 'createdCell', 'data', 'defaultContent', 'name', 'orderable', |
||
20 | 'orderData', 'orderDataType', 'render', 'searchable', 'title', 'type', 'visible', 'width' |
||
21 | ]; |
||
22 | |||
23 | /** |
||
24 | * @var string key/value of options |
||
25 | */ |
||
26 | protected $options; |
||
27 | |||
28 | /** |
||
29 | * @var OptionsResolver |
||
30 | */ |
||
31 | protected $optionsResolver; |
||
32 | |||
33 | /** |
||
34 | * @var \Closure callback that will be used to format this cell values |
||
35 | */ |
||
36 | protected $formatValueCallback; |
||
37 | |||
38 | 14 | public function __construct($title='', $options=[]) |
|
44 | /** |
||
45 | * Column unique identifier |
||
46 | * @param string $identifier |
||
47 | * @return Column |
||
48 | */ |
||
49 | 2 | public function setIdentifier($identifier) |
|
54 | /** |
||
55 | * @param OptionsResolver $resolver |
||
56 | */ |
||
57 | 14 | public function configureOptions(OptionsResolver $resolver) |
|
64 | /** |
||
65 | * @param array $options one within static::$clientSideColumnOptions |
||
66 | */ |
||
67 | 14 | public function setOptions(array $options) |
|
72 | /** |
||
73 | * @return mixed |
||
74 | */ |
||
75 | 4 | public function getOptions() |
|
79 | /** |
||
80 | * @param string $title |
||
81 | * @return Column |
||
82 | */ |
||
83 | public function setTitle($title) |
||
88 | |||
89 | /** |
||
90 | * Format a cell content for this column |
||
91 | * @param $value |
||
92 | * @param array $rowData |
||
93 | * @param $context |
||
94 | * @return mixed |
||
95 | */ |
||
96 | 3 | public function formatCell($value, array $rowData, $context) |
|
104 | |||
105 | /** |
||
106 | * @return \Closure |
||
107 | */ |
||
108 | 1 | public function getFormatValueCallback() |
|
112 | /** |
||
113 | * @param \Closure $callback |
||
114 | */ |
||
115 | 2 | public function setFormatValueCallback(\Closure $callback=null) |
|
120 | /** |
||
121 | * @return string key/value filtered for client side API |
||
122 | */ |
||
123 | 2 | public function getClientSideDefinition() |
|
135 | } |
||
136 |