You are here

interface ForumManagerInterface in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/forum/src/ForumManagerInterface.php \Drupal\forum\ForumManagerInterface

Provides forum manager interface.

Hierarchy

Expanded class hierarchy of ForumManagerInterface

All classes that implement ForumManagerInterface

2 files declare their use of ForumManagerInterface
ForumBreadcrumbBuilderBase.php in core/modules/forum/src/Breadcrumb/ForumBreadcrumbBuilderBase.php
ForumController.php in core/modules/forum/src/Controller/ForumController.php

File

core/modules/forum/src/ForumManagerInterface.php, line 11

Namespace

Drupal\forum
View source
interface ForumManagerInterface {

  /**
   * Gets list of forum topics.
   *
   * @param int $tid
   *   Term ID.
   * @param \Drupal\Core\Session\AccountInterface $account
   *   Account to fetch topics for.
   *
   * @return array
   *   Array with keys 'topics' and 'header'.
   */
  public function getTopics($tid, AccountInterface $account);

  /**
   * Utility method to fetch the child forums for a given forum.
   *
   * @param int $vid
   *   The forum vocabulary ID.
   * @param int $tid
   *   The forum ID to fetch the children for.
   *
   * @return array
   *   Array of children.
   */
  public function getChildren($vid, $tid);

  /**
   * Generates and returns the forum index.
   *
   * The forum index is a pseudo term that provides an overview of all forums.
   *
   * @return \Drupal\taxonomy\TermInterface
   *   A pseudo term representing the overview of all forums.
   */
  public function getIndex();

  /**
   * Resets the ForumManager index and history.
   */
  public function resetCache();

  /**
   * Fetches the parent forums for a given forum.
   *
   * @param int $tid
   *   Term ID.
   *
   * @return array
   *   Array of parent terms.
   *
   * @deprecated in drupal:8.1.0 and is removed from drupal:9.0.0. Call
   * loadAllParents() on taxonomy term storage directly.
   *
   * @see https://www.drupal.org/node/3069599
   */
  public function getParents($tid);

  /**
   * Checks whether a node can be used in a forum, based on its content type.
   *
   * @param \Drupal\node\NodeInterface $node
   *   A node entity.
   *
   * @return bool
   *   Boolean indicating if the node can be assigned to a forum.
   */
  public function checkNodeType(NodeInterface $node);

  /**
   * Calculates the number of new posts in a forum that the user has not yet read.
   *
   * Nodes are new if they are newer than HISTORY_READ_LIMIT.
   *
   * @param int $term
   *   The term ID of the forum.
   * @param int $uid
   *   The user ID.
   *
   * @return
   *   The number of new posts in the forum that have not been read by the user.
   */
  public function unreadTopics($term, $uid);

}

Members

Namesort descending Modifiers Type Description Overrides
ForumManagerInterface::checkNodeType public function Checks whether a node can be used in a forum, based on its content type. 1
ForumManagerInterface::getChildren public function Utility method to fetch the child forums for a given forum. 1
ForumManagerInterface::getIndex public function Generates and returns the forum index. 1
ForumManagerInterface::getParents Deprecated public function Fetches the parent forums for a given forum. 1
ForumManagerInterface::getTopics public function Gets list of forum topics. 1
ForumManagerInterface::resetCache public function Resets the ForumManager index and history. 1
ForumManagerInterface::unreadTopics public function Calculates the number of new posts in a forum that the user has not yet read. 1