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 7587 to 7603

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 14th March 2025 20:35 Europe/London time based on the source file dated 6th March 2025 14:30 Europe/London time.