Collections functions
General functions
Node functions
Render functions
Theme permission functions
User 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 1829 to 1857

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 24th April 2024 21:35 Europe/London time based on the source file dated 15th March 2024 17:00 Europe/London time.