Coding standards
Security in ResourceSpace
Developer reference
Database
Action functions
Admin functions
Ajax functions
Annotation functions
API functions
Collections functions
Comment functions
Config functions
CSV export functions
Dash functions
Debug functions
Encryption functions
Facial recognition functions
File functions
General functions
Language functions
Log functions
Login functions
Message functions
Migration functions
Node functions
PDF functions
Plugin functions
Render functions
Reporting functions
Request functions
Research functions
Slideshow functions
Theme permission functions
User functions
Video functions
Database functions
Metadata functions
Resource functions
Search functions
Map functions
Job functions
Tab functions
Test functions

get_nopreview_html()

Description

Returns the HTML necessary to represent a resource with the given extension when no image preview exists.

Parameters

ColumnTypeDefaultDescription
$extension string File extension
$resource_type int Optional, the resource type of the resource, used to find an icon at the resource type level if an icon for this extension is not defined.

Return

string

Location

include/resource_functions.php lines 7556 to 7572

Definition

 
function get_nopreview_html(string $extension$resource_type null): string
{
    
$extension strtolower(trim($extension));

    if (isset(
FONTAWESOME_EXTENSIONS[$extension])) {
        
// Use the icon set for this file extension
        
$icon FONTAWESOME_EXTENSIONS[$extension];
    } else {
        
// No icon for this specific extension Get default for this resource type and cache it.
        
$icon ps_value("select icon value from resource_type where ref=?", ["i",$resource_type], """resourcetypeicon");
        if (
$icon == "") {
            
$default FONTAWESOME_EXTENSIONS["default"];
        }
    }

    return 
"<i class='nopreview fa fa-solid " $icon "'></i>";
}

This article was last updated 11th February 2025 20:35 Europe/London time based on the source file dated 10th February 2025 10:40 Europe/London time.