discourse/app/assets/javascripts/discourse-common/addon/helpers/fa-icon.js
Joffrey JAFFEUX bc9558550d
DEV: replace registerUnbound usage with default exports (#23802)
`registerUnbound` was present for legacy reasons when using helpers in raw-hbs and has been replaced by `registerRawHelper`.

For new helpers used only in classic ember template, exporting a default function from `helpers/*.js` is recommended.

This change also means that all existing helpers will be available to import in `gjs` files.

Co-authored-by: David Taylor <david@taylorhq.com>
2023-10-19 14:28:25 +01:00

15 lines
506 B
JavaScript

import { htmlSafe } from "@ember/template";
import deprecated from "discourse-common/lib/deprecated";
import { registerRawHelper } from "discourse-common/lib/helpers";
import { renderIcon } from "discourse-common/lib/icon-library";
export function iconHTML(id, params) {
return renderIcon("string", id, params);
}
registerRawHelper("fa-icon", faIcon);
export default function faIcon(icon, params) {
deprecated("Use `{{d-icon}}` instead of `{{fa-icon}}");
return htmlSafe(iconHTML(icon, params));
}