Collections functions
Encryption functions
General functions
Render functions
Theme permission functions
Video functions
Resource functions

dash_tile_featured_collection_get_resources()

Description

Build list of resources that can be shown on a dash tile as a background image. Helper function.

Parameters

ColumnTypeDefaultDescription
$c array|integer Collection ref -or- collection data as returned by {@see get_collection()}
$ctx array Contextual data

Return

array

Location

include/dash_functions.php lines 1795 to 1823

Definition

 
function dash_tile_featured_collection_get_resources($c, array $ctx)
    {
    
$collection = (is_int($c) ? get_collection($c) : $c);
    
$collection = (is_array($collection) && !empty($collection) ? $collection false);
    if(
$collection === false)
        {
        return array();
        }

    global 
$view_title_field;

    
$collection_resources get_collection_resources($collection["ref"]);
    
$collection["has_resources"] = (is_array($collection_resources) && !empty($collection_resources) ? 0);

    
$featured_collection_resources get_featured_collection_resources($collection$ctx);
    
$featured_collection_resources_data get_resource_data_batch($featured_collection_resources);

    
$resources = array();
    foreach(
$featured_collection_resources_data as $resource_data)
        {
        
$resources[] = array(
            
"ref" => $resource_data['ref'],
            
"field{$view_title_field}=> get_data_by_field($resource_data['ref'], $view_title_field),
            
"resource_type" => $resource_data['resource_type'],
            
"file_extension" => $resource_data['file_extension']);
        }

    return 
$resources;
    }

This article was last updated 21st April 2021 19:05 Europe/London time based on the source file dated 12th April 2021 10:20 Europe/London time.