Skip to content

Commit 956c556

Browse files
committed
add icons files
1 parent bb88906 commit 956c556

3 files changed

Lines changed: 19 additions & 0 deletions

File tree

inc/Helpers/Misc.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ function get_file_infos( int $file_id ): array {
4545
'details_accessible' => get_file_detail( $file_name, $file_ext, get_accessible_file_size_label( $file_size ) ),
4646
'href' => $file_href,
4747
'caption' => (string) wp_get_attachment_caption( $file_id ),
48+
'icon' => get_file_icon( $file_ext ),
4849
];
4950
}
5051

@@ -105,3 +106,19 @@ function get_accessible_file_size_label( string $file_size ): string {
105106

106107
return $value . ' ' . $unit_label;
107108
}
109+
110+
/**
111+
* @param string $file_ext
112+
*
113+
* @return string
114+
*/
115+
function get_file_icon( string $file_ext ): string {
116+
117+
$file_icon = 'file';
118+
119+
if ( in_array( $file_ext, [ 'jpg', 'jpeg', 'png', 'gif', 'webp', 'svg', 'bmp', 'ico' ], true ) ) {
120+
$file_icon = 'file-image';
121+
}
122+
123+
return $file_icon;
124+
}
Lines changed: 1 addition & 0 deletions
Loading

src/img/icons/sprite/file.svg

Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)