Collections functions
General functions
Node functions
Render functions
Theme permission functions
User functions
Resource functions

report_process_query_placeholders()

Description

Find and replace a reports' query placeholders with their values.

Parameters

ColumnTypeDefaultDescription
$query string Reports' SQL query
$placeholders: array
$placeholders;
$placeholders array Map between a placeholder and its actual value

Location

include/reporting_functions.php lines 742 to 756

Definition

 
function report_process_query_placeholders(string $query, array $placeholders): string
    
{
    
$default_placeholders = [
        
'[title_field]' => $GLOBALS['view_title_field'],
    ];
    
$all_placeholders array_merge($default_placeholders$placeholders);

    
$sql $query;
    foreach(
$all_placeholders as $placeholder => $value)
        {
        
$sql str_replace($placeholder$value$sql);
        }

    return 
$sql;
    }

This article was last updated 29th May 2024 12:35 Europe/London time based on the source file dated 8th May 2024 18:45 Europe/London time.