Function __global->get_download_category_tree

Definitions

sources/downloads.php

  • Get a list of maps containing all the subcategories, and path information, of the specified download category - and those beneath it, recursively.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: array

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$category_id ?AUTO_LINK No No Null N/A N/A The category being at the root of our recursion (null: true root category)
$breadcrumbs ?string No No Null N/A N/A The breadcrumbs up to this point in the recursion (null: blank, as we are starting the recursion)
$category_info ?array No No Null N/A N/A The category row of the $category_id we are currently going through (null: look it up). This is here for efficiency reasons, as finding children IDs to recurse to also reveals the child's details
$do_stats boolean No No False N/A N/A Whether to collect download counts with our tree information
$use_compound_list boolean No No False N/A N/A Whether to make a compound list (a pair of a comma-separated list of children, and the child array)
$levels ?integer No No Null N/A N/A The number of recursive levels to search (null: all)
$addable_filter boolean No No False N/A N/A Whether to only show for what may be added to by the current member

Returns

  • A list of maps for all subcategories, contains more details if stats were requested
  • Type: array
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Get a list of maps containing all the subcategories, and path information, of the specified download category - and those beneath it, recursively.
 *
 * @param  ?AUTO_LINK $category_id The category being at the root of our recursion (null: true root category)
 * @param  ?string $breadcrumbs The breadcrumbs up to this point in the recursion (null: blank, as we are starting the recursion)
 * @param  ?array $category_info The category row of the $category_id we are currently going through (null: look it up). This is here for efficiency reasons, as finding children IDs to recurse to also reveals the child's details
 * @param  boolean $do_stats Whether to collect download counts with our tree information
 * @param  boolean $use_compound_list Whether to make a compound list (a pair of a comma-separated list of children, and the child array)
 * @param  ?integer $levels The number of recursive levels to search (null: all)
 * @param  boolean $addable_filter Whether to only show for what may be added to by the current member
 * @return array A list of maps for all subcategories, contains more details if stats were requested
 */

function get_download_category_tree(?int $category_id = null, ?string $breadcrumbs = null, ?array $category_info = null, bool $do_stats = false, bool $use_compound_list = false, ?int $levels = null, bool $addable_filter = false) : array