bp_document_svg_icon( $extension, $attachment_id, $type = 'font' )
Return the icon based on the extension.
Description
Parameters
- $extension
-
(Required)
- $attachment_id
-
(Required)
Return
(mixed|void)
Source
File: bp-document/bp-document-functions.php
function bp_document_svg_icon( $extension, $attachment_id = 0 ) { if ( $attachment_id > 0 && '' !== $extension ) { $mime_type = bp_document_mime_type( $attachment_id ); $existing_list = bp_document_extensions_list(); $new_extension = '.' . $extension; $result_array = bp_document_multi_array_search( $existing_list, array( 'extension' => $new_extension, 'mime_type' => $mime_type ) ); if ( $result_array && isset( $result_array[0] ) && ! empty( $result_array[0] ) ) { $icon = $existing_list[ $result_array[0] ]['icon']; if ( '' !== $icon ) { return apply_filters( 'bp_document_svg_icon', $icon, $extension ); } } } $svg = ''; switch ( $extension ) { case '7z': $svg = 'bb-icon-file-7z'; break; case 'abw': $svg = 'bb-icon-file-abw'; break; case 'ace': $svg = 'bb-icon-file-ace'; break; case 'ai': $svg = 'bb-icon-file-ai'; break; case 'apk': $svg = 'bb-icon-file-apk'; break; case 'css': $svg = 'bb-icon-file-css'; break; case 'csv': $svg = 'bb-icon-file-csv'; break; case 'doc': $svg = 'bb-icon-file-doc'; break; case 'docm': $svg = 'bb-icon-file-docm'; break; case 'docx': $svg = 'bb-icon-file-docx'; break; case 'dotm': $svg = 'bb-icon-file-dotm'; break; case 'dotx': $svg = 'bb-icon-file-dotx'; break; case 'eps': $svg = 'bb-icon-file-svg'; break; case 'gif': $svg = 'bb-icon-file-gif'; break; case 'gz': $svg = 'bb-icon-file-zip'; break; case 'gzip': $svg = 'bb-icon-file-zip'; break; case 'hlam': $svg = 'bb-icon-file-hlam'; break; case 'hlsb': $svg = 'bb-icon-file-hlsb'; break; case 'hlsm': $svg = 'bb-icon-file-hlsm'; break; case 'htm': $svg = 'bb-icon-file-html'; break; case 'html': $svg = 'bb-icon-file-html'; break; case 'ics': $svg = 'bb-icon-file-ics'; break; case 'ico': $svg = 'bb-icon-file-ico'; break; case 'ipa': $svg = 'bb-icon-file-ipa'; break; case 'jpg': $svg = 'bb-icon-file-jpg'; break; case 'jpeg': $svg = 'bb-icon-file-jpg'; break; case 'js': $svg = 'bb-icon-file-js'; break; case 'jar': $svg = 'bb-icon-file-jar'; break; case 'mp3': $svg = 'bb-icon-file-mp3'; break; case 'ods': $svg = 'bb-icon-file-ods'; break; case 'odt': $svg = 'bb-icon-file-odt'; break; case 'pdf': $svg = 'bb-icon-file-pdf'; break; case 'png': $svg = 'bb-icon-file-png'; break; case 'psd': $svg = 'bb-icon-file-psd'; break; case 'potm': $svg = 'bb-icon-file-pptm'; break; case 'potx': $svg = 'bb-icon-file-pptx'; break; case 'pps': $svg = 'bb-icon-file-pps'; break; case 'ppsx': $svg = 'bb-icon-file-ppsx'; break; case 'ppt': $svg = 'bb-icon-file-ppt'; break; case 'pptm': $svg = 'bb-icon-file-pptm'; break; case 'pptx': $svg = 'bb-icon-file-pptx'; break; case 'rar': $svg = 'bb-icon-file-rar'; break; case 'rtf': $svg = 'bb-icon-file-rtf'; break; case 'rss': $svg = 'bb-icon-file-rss'; break; case 'sketch': $svg = 'bb-icon-file-sketch'; break; case 'svg': $svg = 'bb-icon-file-svg'; break; case 'tar': $svg = 'bb-icon-file-tar'; break; case 'tif': $svg = 'bb-icon-file-jpg'; break; case 'tiff': $svg = 'bb-icon-file-jpg'; break; case 'txt': $svg = 'bb-icon-file-txt'; break; case 'vcf': $svg = 'bb-icon-file-vcf'; break; case 'wav': $svg = 'bb-icon-file-wav'; break; case 'xlam': $svg = 'bb-icon-file-xls'; break; case 'xls': $svg = 'bb-icon-file-xls'; break; case 'xlsb': $svg = 'bb-icon-file-xls'; break; case 'xlsm': $svg = 'bb-icon-file-xls'; break; case 'xlsx': $svg = 'bb-icon-file-xlsx'; break; case 'xltm': $svg = 'bb-icon-file-xltm'; break; case 'xltx': $svg = 'bb-icon-file-xltx'; break; case 'xml': $svg = 'bb-icon-file-xml'; break; case 'yaml': $svg = 'bb-icon-file-yaml'; break; case 'zip': $svg = 'bb-icon-file-zip'; break; case 'folder': $svg = 'bb-icon-folder-stacked'; break; case 'download': $svg = 'bb-icon-download'; break; default: $svg = 'bb-icon-file'; } return apply_filters( 'bp_document_svg_icon', $svg, $extension ); }
Changelog
Version | Description |
---|---|
BuddyBoss 1.4.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.