Add extension point for custom stored Font Awesome icons#6665
Open
SoftCreatR wants to merge 1 commit intoWoltLab:6.2from
Open
Add extension point for custom stored Font Awesome icons#6665SoftCreatR wants to merge 1 commit intoWoltLab:6.2from
SoftCreatR wants to merge 1 commit intoWoltLab:6.2from
Conversation
Allow FontAwesomeIcon to resolve non-native stored icon strings through a new StoredIconResolving event. This keeps native `name;solid` icon strings unchanged while giving packages a package-safe way to provide custom IFontAwesomeIcon implementations for extended descriptors. Also extend the FontAwesome picker callback contract with optional stored value and preview HTML arguments, and update IconFormField and trophy badge preview handling to use those optional values when provided.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Current State
WoltLab Suite 6.2 icon fields and rendering are effectively limited to native Font Awesome icon strings in the
name;forceSolidformat.This means that packages can replace or extend the icon picker UI, but selected values cannot be accepted globally unless they still look like native WSC icon strings. In practice, this blocks package-safe integrations for icons that need additional identity data, for example:
Without a core extension point, third-party packages must either integrate with each consuming form individually or avoid storing extended icon values.
Proposed State
This PR adds a small extension point around stored icon resolution:
FontAwesomeIcon::isValidString()first accepts native values as before.wcf\event\style\StoredIconResolving.IFontAwesomeIcon.FontAwesomeIcon::fromString()preserves the original stored string and delegates rendering to the resolved icon.The Font Awesome picker callback is also extended in a backwards-compatible way:
Existing picker consumers can continue using only icon and forceSolid. Replacement picker implementations can optionally provide:
IconFormField and trophy badge previews now use these optional values when present, while retaining the native preview path for normal icons.
Why Accept This?
This gives WSC a narrow, package-safe extension point instead of forcing packages to patch core files or duplicate integrations for every icon field.
Benefits:
Downsides
Risks For WSC 6.2
The behavioral risk is low because native icon strings still take the same path as before. Existing callers and picker callbacks remain compatible.
The main 6.2 risk is API commitment: adding StoredIconResolving in a patch release means third-party packages may depend on it immediately. If the event shape should change, that is easier before release than after.
Waiting for 6.3 would reduce that API commitment risk, but it would leave 6.2 without a package-safe way to integrate extended icon sources. For installations already using WSC 6.2, packages would still need brittle field-specific workarounds or core patches.
Compatibility
This is intended to be backwards-compatible: