1 | <?php |
||
7 | class Column implements ColumnInterface |
||
8 | { |
||
9 | /** |
||
10 | * Column field info that might be used client side |
||
11 | * |
||
12 | * https://datatables.net/reference/option/columns |
||
13 | * |
||
14 | * @var array |
||
15 | */ |
||
16 | public static $clientSideColumnOptions = [ |
||
17 | 'cellType','className','contentPadding', 'createdCell', 'data', 'defaultContent', 'name', 'orderable', |
||
18 | 'orderData', 'orderDataType', 'render', 'searchable', 'title', 'type', 'visible', 'width' |
||
19 | ]; |
||
20 | |||
21 | /** |
||
22 | * @var string key/value of options |
||
23 | */ |
||
24 | protected $options; |
||
25 | |||
26 | /** |
||
27 | * @var OptionsResolver |
||
28 | */ |
||
29 | protected $optionsResolver; |
||
30 | |||
31 | /** |
||
32 | * @var \Closure callback that will be used to format this cell values |
||
33 | */ |
||
34 | protected $formatValueCallback; |
||
35 | |||
36 | 15 | public function __construct($title='', $options=[]) |
|
42 | /** |
||
43 | * Column unique identifier |
||
44 | * @param string $identifier |
||
45 | * @return Column |
||
46 | */ |
||
47 | 2 | public function setIdentifier($identifier) |
|
52 | /** |
||
53 | * @param OptionsResolver $resolver |
||
54 | */ |
||
55 | 15 | public function configureOptions(OptionsResolver $resolver) |
|
61 | /** |
||
62 | * @param array $options one within static::$clientSideColumnOptions |
||
63 | */ |
||
64 | 15 | public function setOptions(array $options) |
|
69 | /** |
||
70 | * @return mixed |
||
71 | */ |
||
72 | 5 | public function getOptions() |
|
76 | /** |
||
77 | * @param string $title |
||
78 | * @return Column |
||
79 | */ |
||
80 | public function setTitle($title) |
||
85 | |||
86 | /** |
||
87 | * Format a cell content for this column |
||
88 | * @param $value |
||
89 | * @param array $rowData |
||
90 | * @param $context |
||
91 | * @return mixed |
||
92 | */ |
||
93 | 5 | public function formatCell($value, array $rowData, $context) |
|
101 | |||
102 | /** |
||
103 | * @return \Closure |
||
104 | */ |
||
105 | 1 | public function getFormatValueCallback() |
|
109 | /** |
||
110 | * @param \Closure $callback |
||
111 | */ |
||
112 | 2 | public function setFormatValueCallback(\Closure $callback=null) |
|
117 | /** |
||
118 | * @return string key/value filtered for client side API |
||
119 | */ |
||
120 | public function getClientSideDefinition() |
||
132 | } |
||
133 |