Function __global->sql_region_filter

Definitions

sources/locations.php

  • Get SQL to add to wider SQL query, for region filtering.If the provided region is a region, it will match against any content specifying said region or the full country.If the provided region is a country, it will only match against country-wide content in the same country (it will not match region-specific content).
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: string

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$content_type string No No required parameter N/A N/A The content type
$field_name_to_join string No No required parameter N/A N/A Field name for content ID in table being connected to
$region ?string No No Null N/A N/A Region or country code to show for (null: auto-detect)

Returns

  • SQL
  • Type: string
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Get SQL to add to wider SQL query, for region filtering.If the provided region is a region, it will match against any content specifying said region or the full country.If the provided region is a country, it will only match against country-wide content in the same country (it will not match region-specific content).
 *
 * @param  string $content_type The content type
 * @param  string $field_name_to_join Field name for content ID in table being connected to
 * @param  ?string $region Region or country code to show for (null: auto-detect)
 * @return string SQL
 */

function sql_region_filter(string $content_type, string $field_name_to_join, ?string $region = null) : string