@@ -6,40 +6,40 @@ |
||
6 | 6 | |
7 | 7 | class AttributeColumn extends BaseColumn |
8 | 8 | { |
9 | - public function __construct($config) |
|
10 | - { |
|
11 | - if (is_string($config)) { |
|
12 | - $config = [ |
|
13 | - 'value' => $config, |
|
14 | - ]; |
|
15 | - } |
|
16 | - |
|
17 | - parent::__construct($config); |
|
18 | - |
|
19 | - if (empty($this->title)) { |
|
20 | - $this->title = ucfirst(str_replace('_', ' ', $this->value)); |
|
21 | - } |
|
22 | - } |
|
23 | - |
|
24 | - /** |
|
25 | - * @inheritdoc |
|
26 | - * @throws ColumnRenderException |
|
27 | - */ |
|
28 | - public function renderValue($row) |
|
29 | - { |
|
30 | - if (is_array($row)) { |
|
31 | - |
|
32 | - if (!isset($row[$this->value])) { |
|
33 | - return null; |
|
34 | - } |
|
35 | - |
|
36 | - return $row[$this->value]; |
|
37 | - } |
|
38 | - |
|
39 | - if (!isset($row->{$this->value})) { |
|
40 | - return null; |
|
41 | - } |
|
42 | - |
|
43 | - return $row->{$this->value}; |
|
44 | - } |
|
9 | + public function __construct($config) |
|
10 | + { |
|
11 | + if (is_string($config)) { |
|
12 | + $config = [ |
|
13 | + 'value' => $config, |
|
14 | + ]; |
|
15 | + } |
|
16 | + |
|
17 | + parent::__construct($config); |
|
18 | + |
|
19 | + if (empty($this->title)) { |
|
20 | + $this->title = ucfirst(str_replace('_', ' ', $this->value)); |
|
21 | + } |
|
22 | + } |
|
23 | + |
|
24 | + /** |
|
25 | + * @inheritdoc |
|
26 | + * @throws ColumnRenderException |
|
27 | + */ |
|
28 | + public function renderValue($row) |
|
29 | + { |
|
30 | + if (is_array($row)) { |
|
31 | + |
|
32 | + if (!isset($row[$this->value])) { |
|
33 | + return null; |
|
34 | + } |
|
35 | + |
|
36 | + return $row[$this->value]; |
|
37 | + } |
|
38 | + |
|
39 | + if (!isset($row->{$this->value})) { |
|
40 | + return null; |
|
41 | + } |
|
42 | + |
|
43 | + return $row->{$this->value}; |
|
44 | + } |
|
45 | 45 | } |
46 | 46 | \ No newline at end of file |