@@ -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 |
@@ -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 |
@@ -6,87 +6,87 @@ |
||
6 | 6 | |
7 | 7 | class ActionsColumn extends BaseColumn |
8 | 8 | { |
9 | - /** |
|
10 | - * By default is empty for this column |
|
11 | - * @var string |
|
12 | - */ |
|
13 | - public $title = ''; |
|
14 | - |
|
15 | - /** |
|
16 | - * Value contains short codes for actions |
|
17 | - * @var array |
|
18 | - */ |
|
19 | - public $value = []; |
|
20 | - |
|
21 | - /** |
|
22 | - * @var bool |
|
23 | - */ |
|
24 | - public $sortable = false; |
|
25 | - |
|
26 | - /** |
|
27 | - * @var string |
|
28 | - */ |
|
29 | - public $formatters = []; |
|
30 | - |
|
31 | - /** |
|
32 | - * @var string |
|
33 | - */ |
|
34 | - public $delimiter = ' '; |
|
35 | - |
|
36 | - /** |
|
37 | - * @var null |
|
38 | - */ |
|
39 | - public $filter = null; |
|
40 | - |
|
41 | - public function __construct(array $config) |
|
42 | - { |
|
43 | - parent::__construct($config); |
|
44 | - $this->buildActions(); |
|
45 | - } |
|
46 | - |
|
47 | - protected function buildActions() |
|
48 | - { |
|
49 | - foreach ($this->value as &$action) { |
|
50 | - if (is_object($action)) { |
|
51 | - continue; |
|
52 | - } |
|
53 | - |
|
54 | - if (is_string($action)) { |
|
55 | - $tmp = explode(':', $action); |
|
56 | - |
|
57 | - $action = [ |
|
58 | - 'class' => array_shift($tmp), |
|
59 | - 'args' => $tmp, |
|
60 | - ]; |
|
61 | - } |
|
62 | - |
|
63 | - $className = GridViewHelper::resolveAlias('action', $action['class']); |
|
64 | - $action = new $className(...$action['args']); |
|
65 | - } |
|
66 | - } |
|
67 | - |
|
68 | - /** |
|
69 | - * @return array |
|
70 | - */ |
|
71 | - protected function configTests(): array |
|
72 | - { |
|
73 | - return array_merge(parent::configTests(), [ |
|
74 | - 'value' => 'array', |
|
75 | - 'delimiter' => 'string', |
|
76 | - ]); |
|
77 | - } |
|
78 | - |
|
79 | - /** |
|
80 | - * @inheritdoc |
|
81 | - */ |
|
82 | - public function _renderValue($row) |
|
83 | - { |
|
84 | - $result = []; |
|
85 | - |
|
86 | - foreach ($this->value as $action) { |
|
87 | - $result[] = $action->render($row); |
|
88 | - } |
|
89 | - |
|
90 | - return implode($this->delimiter, $result); |
|
91 | - } |
|
9 | + /** |
|
10 | + * By default is empty for this column |
|
11 | + * @var string |
|
12 | + */ |
|
13 | + public $title = ''; |
|
14 | + |
|
15 | + /** |
|
16 | + * Value contains short codes for actions |
|
17 | + * @var array |
|
18 | + */ |
|
19 | + public $value = []; |
|
20 | + |
|
21 | + /** |
|
22 | + * @var bool |
|
23 | + */ |
|
24 | + public $sortable = false; |
|
25 | + |
|
26 | + /** |
|
27 | + * @var string |
|
28 | + */ |
|
29 | + public $formatters = []; |
|
30 | + |
|
31 | + /** |
|
32 | + * @var string |
|
33 | + */ |
|
34 | + public $delimiter = ' '; |
|
35 | + |
|
36 | + /** |
|
37 | + * @var null |
|
38 | + */ |
|
39 | + public $filter = null; |
|
40 | + |
|
41 | + public function __construct(array $config) |
|
42 | + { |
|
43 | + parent::__construct($config); |
|
44 | + $this->buildActions(); |
|
45 | + } |
|
46 | + |
|
47 | + protected function buildActions() |
|
48 | + { |
|
49 | + foreach ($this->value as &$action) { |
|
50 | + if (is_object($action)) { |
|
51 | + continue; |
|
52 | + } |
|
53 | + |
|
54 | + if (is_string($action)) { |
|
55 | + $tmp = explode(':', $action); |
|
56 | + |
|
57 | + $action = [ |
|
58 | + 'class' => array_shift($tmp), |
|
59 | + 'args' => $tmp, |
|
60 | + ]; |
|
61 | + } |
|
62 | + |
|
63 | + $className = GridViewHelper::resolveAlias('action', $action['class']); |
|
64 | + $action = new $className(...$action['args']); |
|
65 | + } |
|
66 | + } |
|
67 | + |
|
68 | + /** |
|
69 | + * @return array |
|
70 | + */ |
|
71 | + protected function configTests(): array |
|
72 | + { |
|
73 | + return array_merge(parent::configTests(), [ |
|
74 | + 'value' => 'array', |
|
75 | + 'delimiter' => 'string', |
|
76 | + ]); |
|
77 | + } |
|
78 | + |
|
79 | + /** |
|
80 | + * @inheritdoc |
|
81 | + */ |
|
82 | + public function _renderValue($row) |
|
83 | + { |
|
84 | + $result = []; |
|
85 | + |
|
86 | + foreach ($this->value as $action) { |
|
87 | + $result[] = $action->render($row); |
|
88 | + } |
|
89 | + |
|
90 | + return implode($this->delimiter, $result); |
|
91 | + } |
|
92 | 92 | } |
93 | 93 | \ No newline at end of file |
@@ -4,8 +4,8 @@ |
||
4 | 4 | |
5 | 5 | class DeleteAction extends Action |
6 | 6 | { |
7 | - public function __construct(string $url, string $content = '<i class="fa fa-trash-alt"></i>') |
|
8 | - { |
|
9 | - parent::__construct($url, $content, 'DELETE'); |
|
10 | - } |
|
7 | + public function __construct(string $url, string $content = '<i class="fa fa-trash-alt"></i>') |
|
8 | + { |
|
9 | + parent::__construct($url, $content, 'DELETE'); |
|
10 | + } |
|
11 | 11 | } |
12 | 12 | \ No newline at end of file |