88use Cake \View \View ;
99use RuntimeException ;
1010use Shim \Utility \Inflector as ShimInflector ;
11+ use Template \View \Helper \IconHelper ;
1112
1213/**
1314 * Format helper with basic HTML snippets
@@ -24,7 +25,7 @@ class FormatHelper extends Helper {
2425 *
2526 * @var array
2627 */
27- protected array $ helpers = ['Html ' , ' Tools.Icon ' ];
28+ protected array $ helpers = ['Html ' ];
2829
2930 /**
3031 * @var \Cake\View\StringTemplate
@@ -47,6 +48,12 @@ class FormatHelper extends Helper {
4748 * @param array<string, mixed> $config
4849 */
4950 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+
5057 $ defaults = (array )Configure::read ('Format ' ) + $ this ->_defaults ;
5158 $ config += $ defaults ;
5259
@@ -60,6 +67,8 @@ public function __construct(View $View, array $config = []) {
6067 * 'pro' => 'fa4:thumbs-up',
6168 * 'contra' => 'fa4:thumbs-down',
6269 *
70+ * @deprecated Use Template.IconSnippet helper instead.
71+ *
6372 * @param mixed $value Boolish value
6473 * @param array<string, mixed> $options
6574 * @param array<string, mixed> $attributes
@@ -79,6 +88,8 @@ public function thumbs($value, array $options = [], array $attributes = []): str
7988 * 'prev' => 'fa4:arrow-left',
8089 * 'next' => 'fa4:arrow-right',
8190 *
91+ * @deprecated Use Template.IconSnippet helper instead.
92+ *
8293 * @param array $neighbors (containing prev and next)
8394 * @param string $field Field as `Field` or `Model.field` syntax
8495 * @param array<string, mixed> $options :
@@ -190,6 +201,8 @@ public function genderIcon($value, array $options = [], array $attributes = []):
190201 * 'yes' => 'fa4:check',
191202 * 'no' => 'fa4:times',
192203 *
204+ * @deprecated Use Template.IconSnippet helper instead.
205+ *
193206 * @param int|bool $value Value
194207 * @param array<string, mixed> $options
195208 * - on (defaults to 1/true)
0 commit comments