The MediaWiki\Skin\Cosmos\Icon class does some nasty work and quite a hack. We should work on using OOUI icons to replace these other icons, to fit the MediaWiki conventions.
|Declined||Universal_Omega||T264908 Convert Cosmos to use HTML templating|
|Open||None||T265109 Cosmos skin: Work on getting rid of the nasty MediaWiki\Skin\Cosmos\Icon class|
Ultimately the goal should be that we can just store plain SVG files under resources and load them through ResourceLoader. Currently the icon SVG data is stored in a nested associative array, but that's not very nice to have. See https://www.mediawiki.org/wiki/Manual:ResourceLoaderImageModule.php
Switching to ResourceLoaderImageModule would slightly change behavior as they would have to be applied as a background image via the CSS background-image property.
To ensure we can keep the same behavior (for now), we should keep outputting the SVG files into the HTML DOM. We can parse an SVG string to a DOM tree, and then modify the attributes that way.
- Step 1) Set up a function to extract Metadata from svg files to parse them directly on page to maintain current behavior. This function can be created in either a new class, or in SkinCosmos.php.
- Step 2) Generate SVG files from all the icons in Icon.php and upload them to resources/icons.
- Step 3) Replace usages of Icon::getIcon with new function created in step 1.
- Step 4) Delete Icon.php.