Function CMS_Topic->render_posts_from_topic
Definitions
sources/topics.php
- Render posts from a topic (usually tied into AJAX, to get iterative results).
- Visibility: public
- Is abstract?: No
- Is static?: No
- Is final?: No
- Returns: object
Parameters
Name | Type | Passed by reference? | Variadic? | Default | Set | Range | Description |
---|---|---|---|---|---|---|---|
$topic_id | AUTO_LINK | No | No | required parameter | N/A | N/A | The topic ID |
$num_to_show_limit | integer | No | No | required parameter | N/A | N/A | Maximum to load |
$allow_comments | boolean | No | No | required parameter | N/A | N/A | Whether this resource allows comments (if not, this function does nothing - but it's nice to move out this common logic into the shared function) |
$invisible_if_no_comments | boolean | No | No | required parameter | N/A | N/A | Whether the comment box will be invisible if there are not yet any comments (and you're not staff) |
$forum_name | ?string | No | No | required parameter | N/A | N/A | The name of the forum to use (null: default comment forum) |
$preloaded_comments | ?mixed | No | No | required parameter | N/A | N/A | The raw comment array (null: lookup). This is useful if we want to pass it through a filter |
$reverse | boolean | No | No | required parameter | N/A | N/A | Whether to reverse the posts |
$may_reply | boolean | No | No | required parameter | N/A | N/A | Whether the current user may reply to the topic (influences what buttons show) |
$highlight_by_member | ?MEMBER | No | No | required parameter | N/A | N/A | Member to highlight the posts of (null: none) |
$allow_reviews | boolean | No | No | required parameter | N/A | N/A | Whether to allow ratings along with the comment (like reviews) |
$posts | array | No | No | required parameter | N/A | N/A | List of post IDs to load |
$parent_id | AUTO_LINK | No | No | required parameter | N/A | N/A | Parent node being loaded to |
Returns
- The Tempcode for the comment topic
- Type: Tempcode
- Set: N/A
- Range: N/A
Preview
Code (PHP)
/**
* Render posts from a topic (usually tied into AJAX, to get iterative results).
*
* @param AUTO_LINK $topic_id The topic ID
* @param integer $num_to_show_limit Maximum to load
* @param boolean $allow_comments Whether this resource allows comments (if not, this function does nothing - but it's nice to move out this common logic into the shared function)
* @param boolean $invisible_if_no_comments Whether the comment box will be invisible if there are not yet any comments (and you're not staff)
* @param ?string $forum_name The name of the forum to use (null: default comment forum)
* @param ?mixed $preloaded_comments The raw comment array (null: lookup). This is useful if we want to pass it through a filter
* @param boolean $reverse Whether to reverse the posts
* @param boolean $may_reply Whether the current user may reply to the topic (influences what buttons show)
* @param ?MEMBER $highlight_by_member Member to highlight the posts of (null: none)
* @param boolean $allow_reviews Whether to allow ratings along with the comment (like reviews)
* @param array $posts List of post IDs to load
* @param AUTO_LINK $parent_id Parent node being loaded to
* @return Tempcode The Tempcode for the comment topic
*/
public function render_posts_from_topic(int $topic_id, int $num_to_show_limit, bool $allow_comments, bool $invisible_if_no_comments, ?string $forum_name, $preloaded_comments, bool $reverse, bool $may_reply, ?int $highlight_by_member, bool $allow_reviews, array $posts, int $parent_id) : object
* Render posts from a topic (usually tied into AJAX, to get iterative results).
*
* @param AUTO_LINK $topic_id The topic ID
* @param integer $num_to_show_limit Maximum to load
* @param boolean $allow_comments Whether this resource allows comments (if not, this function does nothing - but it's nice to move out this common logic into the shared function)
* @param boolean $invisible_if_no_comments Whether the comment box will be invisible if there are not yet any comments (and you're not staff)
* @param ?string $forum_name The name of the forum to use (null: default comment forum)
* @param ?mixed $preloaded_comments The raw comment array (null: lookup). This is useful if we want to pass it through a filter
* @param boolean $reverse Whether to reverse the posts
* @param boolean $may_reply Whether the current user may reply to the topic (influences what buttons show)
* @param ?MEMBER $highlight_by_member Member to highlight the posts of (null: none)
* @param boolean $allow_reviews Whether to allow ratings along with the comment (like reviews)
* @param array $posts List of post IDs to load
* @param AUTO_LINK $parent_id Parent node being loaded to
* @return Tempcode The Tempcode for the comment topic
*/
public function render_posts_from_topic(int $topic_id, int $num_to_show_limit, bool $allow_comments, bool $invisible_if_no_comments, ?string $forum_name, $preloaded_comments, bool $reverse, bool $may_reply, ?int $highlight_by_member, bool $allow_reviews, array $posts, int $parent_id) : object