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