8
8
use Cake \View \View ;
9
9
use RuntimeException ;
10
10
use Shim \Utility \Inflector as ShimInflector ;
11
+ use Template \View \Helper \IconHelper ;
11
12
12
13
/**
13
14
* Format helper with basic HTML snippets
@@ -24,7 +25,7 @@ class FormatHelper extends Helper {
24
25
*
25
26
* @var array
26
27
*/
27
- protected array $ helpers = ['Html ' , ' Tools.Icon ' ];
28
+ protected array $ helpers = ['Html ' ];
28
29
29
30
/**
30
31
* @var \Cake\View\StringTemplate
@@ -47,6 +48,12 @@ class FormatHelper extends Helper {
47
48
* @param array<string, mixed> $config
48
49
*/
49
50
public function __construct (View $ View , array $ config = []) {
51
+ if (class_exists (IconHelper::class)) {
52
+ $ this ->helpers [] = 'Template.Icon ' ;
53
+ } else {
54
+ $ this ->helpers [] = 'Tools.Icon ' ;
55
+ }
56
+
50
57
$ defaults = (array )Configure::read ('Format ' ) + $ this ->_defaults ;
51
58
$ config += $ defaults ;
52
59
@@ -60,6 +67,8 @@ public function __construct(View $View, array $config = []) {
60
67
* 'pro' => 'fa4:thumbs-up',
61
68
* 'contra' => 'fa4:thumbs-down',
62
69
*
70
+ * @deprecated Use Template.IconSnippet helper instead.
71
+ *
63
72
* @param mixed $value Boolish value
64
73
* @param array<string, mixed> $options
65
74
* @param array<string, mixed> $attributes
@@ -79,6 +88,8 @@ public function thumbs($value, array $options = [], array $attributes = []): str
79
88
* 'prev' => 'fa4:arrow-left',
80
89
* 'next' => 'fa4:arrow-right',
81
90
*
91
+ * @deprecated Use Template.IconSnippet helper instead.
92
+ *
82
93
* @param array $neighbors (containing prev and next)
83
94
* @param string $field Field as `Field` or `Model.field` syntax
84
95
* @param array<string, mixed> $options :
@@ -190,6 +201,8 @@ public function genderIcon($value, array $options = [], array $attributes = []):
190
201
* 'yes' => 'fa4:check',
191
202
* 'no' => 'fa4:times',
192
203
*
204
+ * @deprecated Use Template.IconSnippet helper instead.
205
+ *
193
206
* @param int|bool $value Value
194
207
* @param array<string, mixed> $options
195
208
* - on (defaults to 1/true)
0 commit comments