3 namespace Drupal\forum;
5 use Drupal\Core\Session\AccountInterface;
6 use Drupal\node\NodeInterface;
9 * Provides forum manager interface.
11 interface ForumManagerInterface {
14 * Gets list of forum topics.
18 * @param \Drupal\Core\Session\AccountInterface $account
19 * Account to fetch topics for.
22 * Array with keys 'topics' and 'header'.
24 public function getTopics($tid, AccountInterface $account);
27 * Utility method to fetch the child forums for a given forum.
30 * The forum vocabulary ID.
32 * The forum ID to fetch the children for.
37 public function getChildren($vid, $tid);
40 * Generates and returns the forum index.
42 * The forum index is a pseudo term that provides an overview of all forums.
44 * @return \Drupal\taxonomy\TermInterface
45 * A pseudo term representing the overview of all forums.
47 public function getIndex();
50 * Resets the ForumManager index and history.
52 public function resetCache();
55 * Fetches the parent forums for a given forum.
61 * Array of parent terms.
63 * @deprecated Scheduled to be removed in 9.0.x, see
64 * https://www.drupal.org/node/2371593.
66 public function getParents($tid);
69 * Checks whether a node can be used in a forum, based on its content type.
71 * @param \Drupal\node\NodeInterface $node
75 * Boolean indicating if the node can be assigned to a forum.
77 public function checkNodeType(NodeInterface $node);
80 * Calculates the number of new posts in a forum that the user has not yet read.
82 * Nodes are new if they are newer than HISTORY_READ_LIMIT.
85 * The term ID of the forum.
90 * The number of new posts in the forum that have not been read by the user.
92 public function unreadTopics($term, $uid);