Jump to content

InputField Icon not up to date?


gebeer
 Share

Recommended Posts

Hello,

I would like to utilize wire/modules/Inputfield/InputfieldIcon/ in a module.

I found that icons.inc there does not include all FontAwesome 4.4 icon classes.

Is the selection of icon classes in icons.inc opinionated for use in PW or is it just not up to date?

Anyways, I put together some code to produce a icons.inc with all available FA icon classes from master branch, sorted alphabetically:

<?php 
$url = "https://raw.githubusercontent.com/FortAwesome/Font-Awesome/master/src/icons.yml";
$faArray = yaml_parse_url($url);

// pack all icon ids (classnames) in array and sort alphabetically
$iconClasses = [];
foreach ($faArray['icons'] as $key => $row) {
	$iconClasses[$key] = $row['id'];
}
array_multisort($iconClasses, SORT_ASC, $faArray['icons']);

// write all fa classnames to a file
$file = "icons.inc";
$prefix = "fa-";

$out = fopen($file, "w+");

foreach ($iconClasses as $c) {
	$class = $prefix . $c . PHP_EOL;
	// echo $class . "<br>";
	fwrite($out, $class);
}

fclose($out);
  • Like 3
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...