@@ -4,8 +4,8 @@ |
||
4 | 4 | |
5 | 5 | class UrlFormatter implements IFormatter |
6 | 6 | { |
7 | - public function format($value): string |
|
8 | - { |
|
9 | - return '<a href="' . htmlspecialchars($value, ENT_QUOTES) . '">' . htmlentities($value) . '</a>'; |
|
10 | - } |
|
7 | + public function format($value): string |
|
8 | + { |
|
9 | + return '<a href="' . htmlspecialchars($value, ENT_QUOTES) . '">' . htmlentities($value) . '</a>'; |
|
10 | + } |
|
11 | 11 | } |
12 | 12 | \ No newline at end of file |
@@ -4,8 +4,8 @@ |
||
4 | 4 | |
5 | 5 | class TextFormatter implements IFormatter |
6 | 6 | { |
7 | - public function format($value): string |
|
8 | - { |
|
9 | - return htmlentities($value); |
|
10 | - } |
|
7 | + public function format($value): string |
|
8 | + { |
|
9 | + return htmlentities($value); |
|
10 | + } |
|
11 | 11 | } |
12 | 12 | \ No newline at end of file |
@@ -4,8 +4,8 @@ |
||
4 | 4 | |
5 | 5 | class ImageFormatter implements IFormatter |
6 | 6 | { |
7 | - public function format($value): string |
|
8 | - { |
|
9 | - return '<img src="' . htmlspecialchars($value, ENT_QUOTES) . '">'; |
|
10 | - } |
|
7 | + public function format($value): string |
|
8 | + { |
|
9 | + return '<img src="' . htmlspecialchars($value, ENT_QUOTES) . '">'; |
|
10 | + } |
|
11 | 11 | } |
12 | 12 | \ No newline at end of file |
@@ -4,5 +4,5 @@ |
||
4 | 4 | |
5 | 5 | interface IFormatter |
6 | 6 | { |
7 | - public function format($value) : string; |
|
7 | + public function format($value) : string; |
|
8 | 8 | } |
9 | 9 | \ No newline at end of file |
@@ -4,8 +4,8 @@ |
||
4 | 4 | |
5 | 5 | class EmailFormatter implements IFormatter |
6 | 6 | { |
7 | - public function format($value): string |
|
8 | - { |
|
9 | - return '<a href="mailto:' . htmlspecialchars($value, ENT_QUOTES) . '">' . htmlentities($value) . '</a>'; |
|
10 | - } |
|
7 | + public function format($value): string |
|
8 | + { |
|
9 | + return '<a href="mailto:' . htmlspecialchars($value, ENT_QUOTES) . '">' . htmlentities($value) . '</a>'; |
|
10 | + } |
|
11 | 11 | } |
12 | 12 | \ No newline at end of file |
@@ -9,57 +9,57 @@ |
||
9 | 9 | |
10 | 10 | class AttributeColumn extends BaseColumn |
11 | 11 | { |
12 | - public $formatters = ['text']; |
|
12 | + public $formatters = ['text']; |
|
13 | 13 | |
14 | - public $filter = TextFilter::class; |
|
14 | + public $filter = TextFilter::class; |
|
15 | 15 | |
16 | - /** |
|
17 | - * AttributeColumn constructor. |
|
18 | - * @param $config |
|
19 | - * @throws GridViewConfigException |
|
20 | - */ |
|
21 | - public function __construct($config) |
|
22 | - { |
|
23 | - parent::__construct($config); |
|
16 | + /** |
|
17 | + * AttributeColumn constructor. |
|
18 | + * @param $config |
|
19 | + * @throws GridViewConfigException |
|
20 | + */ |
|
21 | + public function __construct($config) |
|
22 | + { |
|
23 | + parent::__construct($config); |
|
24 | 24 | |
25 | - if (empty($this->title)) { |
|
26 | - $this->title = GridViewHelper::columnTitle($this->value); |
|
27 | - } |
|
28 | - } |
|
25 | + if (empty($this->title)) { |
|
26 | + $this->title = GridViewHelper::columnTitle($this->value); |
|
27 | + } |
|
28 | + } |
|
29 | 29 | |
30 | - /** |
|
31 | - * @return array |
|
32 | - */ |
|
33 | - protected function configTests(): array |
|
34 | - { |
|
35 | - return array_merge(parent::configTests(), [ |
|
36 | - 'value' => 'string', |
|
37 | - ]); |
|
38 | - } |
|
30 | + /** |
|
31 | + * @return array |
|
32 | + */ |
|
33 | + protected function configTests(): array |
|
34 | + { |
|
35 | + return array_merge(parent::configTests(), [ |
|
36 | + 'value' => 'string', |
|
37 | + ]); |
|
38 | + } |
|
39 | 39 | |
40 | - /** |
|
41 | - * @inheritdoc |
|
42 | - */ |
|
43 | - public function _renderValue($row) |
|
44 | - { |
|
45 | - $path = $row; |
|
46 | - $exp = explode('.', $this->value); |
|
40 | + /** |
|
41 | + * @inheritdoc |
|
42 | + */ |
|
43 | + public function _renderValue($row) |
|
44 | + { |
|
45 | + $path = $row; |
|
46 | + $exp = explode('.', $this->value); |
|
47 | 47 | |
48 | - /** |
|
49 | - * Extract dots notation (column.sub.sub) |
|
50 | - */ |
|
51 | - foreach ($exp as $part) { |
|
48 | + /** |
|
49 | + * Extract dots notation (column.sub.sub) |
|
50 | + */ |
|
51 | + foreach ($exp as $part) { |
|
52 | 52 | |
53 | - if (isset($path[$part])) { |
|
54 | - $path = $path[$part]; |
|
53 | + if (isset($path[$part])) { |
|
54 | + $path = $path[$part]; |
|
55 | 55 | |
56 | - } elseif (isset($path->$part)) { |
|
57 | - $path = $path[$part]; |
|
58 | - } else { |
|
59 | - return $this->emptyValue; |
|
60 | - } |
|
61 | - } |
|
56 | + } elseif (isset($path->$part)) { |
|
57 | + $path = $path[$part]; |
|
58 | + } else { |
|
59 | + return $this->emptyValue; |
|
60 | + } |
|
61 | + } |
|
62 | 62 | |
63 | - return $path; |
|
64 | - } |
|
63 | + return $path; |
|
64 | + } |
|
65 | 65 | } |
66 | 66 | \ No newline at end of file |
@@ -7,16 +7,16 @@ |
||
7 | 7 | |
8 | 8 | class ViewColumn extends BaseColumn |
9 | 9 | { |
10 | - public $formatters = []; |
|
10 | + public $formatters = []; |
|
11 | 11 | |
12 | - /** |
|
13 | - * Render column value for row |
|
14 | - * @param array|object $row |
|
15 | - * @return string|mixed |
|
16 | - * @throws Throwable |
|
17 | - */ |
|
18 | - protected function _renderValue($row) |
|
19 | - { |
|
20 | - return view($this->value, $row)->render(); |
|
21 | - } |
|
12 | + /** |
|
13 | + * Render column value for row |
|
14 | + * @param array|object $row |
|
15 | + * @return string|mixed |
|
16 | + * @throws Throwable |
|
17 | + */ |
|
18 | + protected function _renderValue($row) |
|
19 | + { |
|
20 | + return view($this->value, $row)->render(); |
|
21 | + } |
|
22 | 22 | } |
23 | 23 | \ No newline at end of file |
@@ -9,32 +9,32 @@ |
||
9 | 9 | |
10 | 10 | abstract class BaseRenderer |
11 | 11 | { |
12 | - use Configurable; |
|
12 | + use Configurable; |
|
13 | 13 | |
14 | - /** |
|
15 | - * @var GridView |
|
16 | - */ |
|
17 | - public $gridView; |
|
14 | + /** |
|
15 | + * @var GridView |
|
16 | + */ |
|
17 | + public $gridView; |
|
18 | 18 | |
19 | - /** |
|
20 | - * BaseRenderer constructor. |
|
21 | - * @param $config |
|
22 | - * @throws GridViewConfigException |
|
23 | - */ |
|
24 | - public function __construct($config) |
|
25 | - { |
|
26 | - $this->loadConfig($config); |
|
27 | - } |
|
19 | + /** |
|
20 | + * BaseRenderer constructor. |
|
21 | + * @param $config |
|
22 | + * @throws GridViewConfigException |
|
23 | + */ |
|
24 | + public function __construct($config) |
|
25 | + { |
|
26 | + $this->loadConfig($config); |
|
27 | + } |
|
28 | 28 | |
29 | - /** |
|
30 | - * @return array |
|
31 | - */ |
|
32 | - protected function configTests(): array |
|
33 | - { |
|
34 | - return [ |
|
35 | - 'gridView' => GridView::class, |
|
36 | - ]; |
|
37 | - } |
|
29 | + /** |
|
30 | + * @return array |
|
31 | + */ |
|
32 | + protected function configTests(): array |
|
33 | + { |
|
34 | + return [ |
|
35 | + 'gridView' => GridView::class, |
|
36 | + ]; |
|
37 | + } |
|
38 | 38 | |
39 | - public abstract function render() : string; |
|
39 | + public abstract function render() : string; |
|
40 | 40 | } |
41 | 41 | \ No newline at end of file |
@@ -7,22 +7,22 @@ |
||
7 | 7 | |
8 | 8 | class DefaultRenderer extends BaseRenderer |
9 | 9 | { |
10 | - /** |
|
11 | - * @return string |
|
12 | - * @throws \Throwable |
|
13 | - */ |
|
14 | - public function render(): string |
|
15 | - { |
|
16 | - $filters = []; |
|
17 | - foreach ($this->gridView->columns as $column) { |
|
18 | - if ($column->filter) { |
|
19 | - $filters[$column->filter->name] = $this->gridView->getRequest()->getFilterValue($column->filter->name); |
|
20 | - } |
|
21 | - } |
|
10 | + /** |
|
11 | + * @return string |
|
12 | + * @throws \Throwable |
|
13 | + */ |
|
14 | + public function render(): string |
|
15 | + { |
|
16 | + $filters = []; |
|
17 | + foreach ($this->gridView->columns as $column) { |
|
18 | + if ($column->filter) { |
|
19 | + $filters[$column->filter->name] = $this->gridView->getRequest()->getFilterValue($column->filter->name); |
|
20 | + } |
|
21 | + } |
|
22 | 22 | |
23 | - return view('woo_gridview::renderers.default', [ |
|
24 | - 'grid' => $this->gridView, |
|
25 | - 'filters' => $filters, |
|
26 | - ])->render(); |
|
27 | - } |
|
23 | + return view('woo_gridview::renderers.default', [ |
|
24 | + 'grid' => $this->gridView, |
|
25 | + 'filters' => $filters, |
|
26 | + ])->render(); |
|
27 | + } |
|
28 | 28 | } |
29 | 29 | \ No newline at end of file |