Function __global->process_sorting_params

Definitions

sources/global3.php

  • Validate the given URL sorting parameters and transform them into usable information.This should be used on all sortables interfaces.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: array

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$content_type ID_TEXT No No required parameter N/A N/A The content type on which we are sorting
$url_sort string No No required parameter N/A N/A The URL sort string
$allowed_sorts ?array No No Null N/A N/A List of allowed sort types (null: default set for the content type)
$strict_error boolean No No True N/A N/A Provide a hack-attack error on invalid input

Returns

  • A tuple: The SQL-style sort order, The sort direction, the sort type based on the URL sort string
  • Type: array
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Validate the given URL sorting parameters and transform them into usable information.This should be used on all sortables interfaces.
 *
 * @param  ID_TEXT $content_type The content type on which we are sorting
 * @param  string $url_sort The URL sort string
 * @param  ?array $allowed_sorts List of allowed sort types (null: default set for the content type)
 * @param  boolean $strict_error Provide a hack-attack error on invalid input
 * @return array A tuple: The SQL-style sort order, The sort direction, the sort type based on the URL sort string
 */

function process_sorting_params(string $content_type, string $url_sort, ?array $allowed_sorts = null, bool $strict_error = true) : array