Google Material 图标作为数组 - 有什么想法吗?
Google Material Icons as array - any ideas?
我正在我的应用程序中实现 Google Material 图标 - https://www.google.com/design/icons/
我希望能够填充 select
字段,以便它显示图标的名称或图标本身,以及 [=15= 的 value
] 是数字字符引用(因此它与不支持连字的浏览器兼容 - IE < 10)。
我想将所有图标放入一个数组中,以便生成 select
的 option
个元素。所以,这种事情:
$icons = array(
"" => "3d rotation",
"" => "accessibility",
etc. etc.
);
我不想坐下来手动从所有 750 个项目创建这个数组,所以我想知道是否有人对自动执行此操作有任何想法?
我已经设法以半自动化的方式做到了这一点。
以下是可能需要它的其他人的数组:PasteBin
希望这对某人有所帮助!
您可以加载字体附带的 MaterialIcons-Regular.ijmap
json 文件。
PHP 示例显示:
// Get the contents on the ijmap bundled with the icon font
$list = json_decode(file_get_contents('path/to/MaterialIcons-Regular.ijmap'), true);
$icons = [];
foreach ($list['icons'] as $i => $data) {
$icons[$i] = $data['name'];
}
我正在我的应用程序中实现 Google Material 图标 - https://www.google.com/design/icons/
我希望能够填充 select
字段,以便它显示图标的名称或图标本身,以及 [=15= 的 value
] 是数字字符引用(因此它与不支持连字的浏览器兼容 - IE < 10)。
我想将所有图标放入一个数组中,以便生成 select
的 option
个元素。所以,这种事情:
$icons = array(
"" => "3d rotation",
"" => "accessibility",
etc. etc.
);
我不想坐下来手动从所有 750 个项目创建这个数组,所以我想知道是否有人对自动执行此操作有任何想法?
我已经设法以半自动化的方式做到了这一点。
以下是可能需要它的其他人的数组:PasteBin
希望这对某人有所帮助!
您可以加载字体附带的 MaterialIcons-Regular.ijmap
json 文件。
PHP 示例显示:
// Get the contents on the ijmap bundled with the icon font
$list = json_decode(file_get_contents('path/to/MaterialIcons-Regular.ijmap'), true);
$icons = [];
foreach ($list['icons'] as $i => $data) {
$icons[$i] = $data['name'];
}