Drupal 8  8.0.2
ForumManager Class Reference
Inheritance diagram for ForumManager:

Public Member Functions

 __construct (ConfigFactoryInterface $config_factory, EntityManagerInterface $entity_manager, Connection $connection, TranslationInterface $string_translation, CommentManagerInterface $comment_manager)
 
 getTopics ($tid, AccountInterface $account)
 
 getChildren ($vid, $tid)
 
 getIndex ()
 
 resetCache ()
 
 getParents ($tid)
 
 checkNodeType (NodeInterface $node)
 
 unreadTopics ($term, $uid)
 
 __sleep ()
 
 __wakeup ()
 

Data Fields

__sleep as defaultSleep
 
const NEWEST_FIRST = 1
 
const OLDEST_FIRST = 2
 
const MOST_POPULAR_FIRST = 3
 
const LEAST_POPULAR_FIRST = 4
 

Protected Member Functions

 getTopicOrder ($sortby)
 
 lastVisit ($nid, AccountInterface $account)
 
 getLastPost ($tid)
 
 getForumStatistics ($tid)
 

Protected Attributes

 $configFactory
 
 $entityManager
 
 $connection
 
 $commentManager
 
 $lastPostData = array()
 
 $forumStatistics = array()
 
 $forumChildren = array()
 
 $history = array()
 
 $index
 

Detailed Description

Provides forum manager service.

Constructor & Destructor Documentation

__construct ( ConfigFactoryInterface  $config_factory,
EntityManagerInterface  $entity_manager,
Connection  $connection,
TranslationInterface  $string_translation,
CommentManagerInterface  $comment_manager 
)

Constructs the forum manager service.

Parameters
\Drupal\Core\Config\ConfigFactoryInterface$config_factoryThe config factory service.
\Drupal\Core\Entity\EntityManagerInterface$entity_managerThe entity manager service.
\Drupal\Core\Database\Connection$connectionThe current database connection.
\Drupal\Core\StringTranslation\TranslationInterface$string_translationThe translation manager service.
\Drupal\comment\CommentManagerInterface$comment_managerThe comment manager service.

References Drupal\configFactory(), and Drupal\entityManager().

Here is the call graph for this function:

Member Function Documentation

__sleep ( )

{}

__wakeup ( )

{}

checkNodeType ( NodeInterface  $node)

{Checks whether a node can be used in a forum, based on its content type.

Parameters
\Drupal\node\NodeInterface$nodeA node entity.
Returns
bool Boolean indicating if the node can be assigned to a forum.
}

Implements ForumManagerInterface.

References EntityInterface\bundle(), and Drupal\entityManager().

Here is the call graph for this function:

getChildren (   $vid,
  $tid 
)

{Utility method to fetch the child forums for a given forum.

Parameters
int$vidThe forum vocabulary ID.
int$tidThe forum ID to fetch the children for.
Returns
array Array of children.
}

Implements ForumManagerInterface.

References Drupal\entityManager().

Here is the call graph for this function:

getForumStatistics (   $tid)
protected

Provides statistics for a forum.

Parameters
int$tidThe forum tid.
Returns
|null Statistics for the given forum if statistics exist, else NULL.
getIndex ( )

{Generates and returns the forum index.The forum index is a pseudo term that provides an overview of all forums.

Returns
A pseudo term representing the overview of all forums.
}

Implements ForumManagerInterface.

References Drupal\configFactory(), and Drupal\entityManager().

Here is the call graph for this function:

getLastPost (   $tid)
protected

Provides the last post information for the given forum tid.

Parameters
int$tidThe forum tid.
Returns
The last post for the given forum.
getParents (   $tid)

{Fetches the parent forums for a given forum.

Parameters
int$tidTerm ID.
Returns
array Array of parent terms.
Deprecated:
Scheduled to be removed in 9.0.x, see https://www.drupal.org/node/2371593.
}

Implements ForumManagerInterface.

References Drupal\entityManager().

Here is the call graph for this function:

getTopicOrder (   $sortby)
protected

Gets topic sorting information based on an integer code.

Parameters
int$sortbyOne of the following integers indicating the sort criteria:
Returns
array An array with the following values:
  • field: A field for an SQL query.
  • sort: 'asc' or 'desc'.

Referenced by ForumManager\getTopics().

Here is the caller graph for this function:

getTopics (   $tid,
AccountInterface  $account 
)

{Gets list of forum topics.

Parameters
int$tidTerm ID.
\Drupal\Core\Session\AccountInterface$accountAccount to fetch topics for.
Returns
array Array with keys 'topics' and 'header'.
}

Implements ForumManagerInterface.

References Drupal\configFactory(), Drupal\entityManager(), ForumManager\getTopicOrder(), and t().

Here is the call graph for this function:

lastVisit (   $nid,
AccountInterface  $account 
)
protected

Gets the last time the user viewed a node.

Parameters
int$nidThe node ID.
\Drupal\Core\Session\AccountInterface$accountAccount to fetch last time for.
Returns
int The timestamp when the user last viewed this node, if the user has previously viewed the node; otherwise HISTORY_READ_LIMIT.

References AccountInterface\id().

Here is the call graph for this function:

resetCache ( )

{Resets the ForumManager index and history.}

Implements ForumManagerInterface.

unreadTopics (   $term,
  $uid 
)

{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.

Parameters
int$termThe term ID of the forum.
int$uidThe user ID.
Returns
The number of new posts in the forum that have not been read by the user.
}

Implements ForumManagerInterface.

Field Documentation

const LEAST_POPULAR_FIRST = 4

Forum sort order, posts with the least comments first.

const MOST_POPULAR_FIRST = 3

Forum sort order, posts with most comments first.

const NEWEST_FIRST = 1

Forum sort order, newest first.

const OLDEST_FIRST = 2

Forum sort order, oldest first.


The documentation for this class was generated from the following file: