9e8833ebcf356c0ed202fa3920f7e8a501bd1086
[yaffs-website] / web / core / modules / forum / src / ForumManagerInterface.php
1 <?php
2
3 namespace Drupal\forum;
4
5 use Drupal\Core\Session\AccountInterface;
6 use Drupal\node\NodeInterface;
7
8 /**
9  * Provides forum manager interface.
10  */
11 interface ForumManagerInterface {
12
13   /**
14    * Gets list of forum topics.
15    *
16    * @param int $tid
17    *   Term ID.
18    * @param \Drupal\Core\Session\AccountInterface $account
19    *   Account to fetch topics for.
20    *
21    * @return array
22    *   Array with keys 'topics' and 'header'.
23    */
24   public function getTopics($tid, AccountInterface $account);
25
26   /**
27    * Utility method to fetch the child forums for a given forum.
28    *
29    * @param int $vid
30    *   The forum vocabulary ID.
31    * @param int $tid
32    *   The forum ID to fetch the children for.
33    *
34    * @return array
35    *   Array of children.
36    */
37   public function getChildren($vid, $tid);
38
39   /**
40    * Generates and returns the forum index.
41    *
42    * The forum index is a pseudo term that provides an overview of all forums.
43    *
44    * @return \Drupal\taxonomy\TermInterface
45    *   A pseudo term representing the overview of all forums.
46    */
47   public function getIndex();
48
49   /**
50    * Resets the ForumManager index and history.
51    */
52   public function resetCache();
53
54   /**
55    * Fetches the parent forums for a given forum.
56    *
57    * @param int $tid
58    *   Term ID.
59    *
60    * @return array
61    *   Array of parent terms.
62    *
63    * @deprecated Scheduled to be removed in 9.0.x, see
64    *   https://www.drupal.org/node/2371593.
65    */
66   public function getParents($tid);
67
68   /**
69    * Checks whether a node can be used in a forum, based on its content type.
70    *
71    * @param \Drupal\node\NodeInterface $node
72    *   A node entity.
73    *
74    * @return bool
75    *   Boolean indicating if the node can be assigned to a forum.
76    */
77   public function checkNodeType(NodeInterface $node);
78
79   /**
80    * Calculates the number of new posts in a forum that the user has not yet read.
81    *
82    * Nodes are new if they are newer than HISTORY_READ_LIMIT.
83    *
84    * @param int $term
85    *   The term ID of the forum.
86    * @param int $uid
87    *   The user ID.
88    *
89    * @return
90    *   The number of new posts in the forum that have not been read by the user.
91    */
92   public function unreadTopics($term, $uid);
93
94 }