Function CMS_Topic->_arrange_posts_in_tree

Definitions

sources/topics.php

  • Arrange posts underneath a post in the thread (not including the post itself).
  • Visibility: protected
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: array

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$post_id ?AUTO_LINK No No required parameter N/A N/A Reference post in thread (null: root)
&$posts array Yes No required parameter N/A N/A Posts we will be rendering and have not arranged yet (only some of which will be underneath $post_id)
$queue array No No required parameter N/A N/A Posts we won't be rendering
$max_thread_depth integer No No required parameter N/A N/A Maximum depth to render to
$depth integer No No 0 N/A N/A Current depth in recursion

Returns

  • Array structure of rendered posts
  • Type: array
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Arrange posts underneath a post in the thread (not including the post itself).
 *
 * @param  ?AUTO_LINK $post_id Reference post in thread (null: root)
 * @param  array $posts Posts we will be rendering and have not arranged yet (only some of which will be underneath $post_id)
 * @param  array $queue Posts we won't be rendering
 * @param  integer $max_thread_depth Maximum depth to render to
 * @param  integer $depth Current depth in recursion
 * @return array Array structure of rendered posts
 */

protected function _arrange_posts_in_tree(?int $post_id, array &$posts, array $queue, int $max_thread_depth, int $depth = 0) : array