ForumManager
class ForumManager implements ForumManagerInterface (View source)
Provides forum manager service.
Traits
Wrapper methods for \Drupal\Core\StringTranslation\TranslationInterface.
Provides dependency injection friendly methods for serialization.
Constants
| NEWEST_FIRST |
Forum sort order, newest first. |
| OLDEST_FIRST |
Forum sort order, oldest first. |
| MOST_POPULAR_FIRST |
Forum sort order, posts with most comments first. |
| LEAST_POPULAR_FIRST |
Forum sort order, posts with the least comments first. |
Properties
| protected TranslationInterface | $stringTranslation | The string translation service. |
from StringTranslationTrait |
| protected array | $_serviceIds | An array of service IDs keyed by property name used for serialization. |
from DependencySerializationTrait |
| protected array | $_entityStorages | An array of entity type IDs keyed by the property name of their storages. |
from DependencySerializationTrait |
| protected ConfigFactoryInterface | $configFactory | Forum settings config object. |
|
| protected EntityFieldManagerInterface | $entityFieldManager | Entity field manager. |
|
| protected EntityTypeManagerInterface | $entityTypeManager | Entity type manager. |
|
| protected Connection | $connection | Database connection. |
|
| protected CommentManagerInterface | $commentManager | The comment manager service. |
|
| protected array | $lastPostData | Array of last post information keyed by forum (term) id. |
|
| protected array | $forumStatistics | Array of forum statistics keyed by forum (term) id. |
|
| protected array | $forumChildren | Array of forum children keyed by parent forum (term) id. |
|
| protected array | $history | Array of history keyed by nid. |
|
| protected TermInterface | $index | Cached forum index. |
Methods
Translates a string to the current language or to a given language.
Formats a string containing a count of items.
Returns the number of plurals supported by a given language.
Gets the string translation service.
{@inheritdoc}
{@inheritdoc}
Constructs the forum manager service.
Gets topic sorting information based on an integer code.
Provides the last post information for the given forum tid.
Provides statistics for a forum.
Utility method to fetch the child forums for a given forum.
Generates and returns the forum index.
Resets the ForumManager index and history.
Checks whether a node can be used in a forum, based on its content type.
Calculates the number of new posts in a forum that the user has not yet read.
Details
protected TranslatableMarkup
t(string $string, array $args = [], array $options = [])
Translates a string to the current language or to a given language.
See \Drupal\Core\StringTranslation\TranslatableMarkup::__construct() for important security information and usage guidelines.
In order for strings to be localized, make them available in one of the ways supported by the
protected
formatPlural($count, $singular, $plural, array $args = [], array $options = [])
Formats a string containing a count of items.
protected
getNumberOfPlurals($langcode = NULL)
Returns the number of plurals supported by a given language.
protected TranslationInterface
getStringTranslation()
Gets the string translation service.
$this
setStringTranslation(TranslationInterface $translation)
Sets the string translation service to use.
__sleep()
{@inheritdoc}
__wakeup()
{@inheritdoc}
__construct(ConfigFactoryInterface $config_factory, EntityTypeManagerInterface $entity_type_manager, Connection $connection, TranslationInterface $string_translation, CommentManagerInterface $comment_manager, EntityFieldManagerInterface $entity_field_manager)
Constructs the forum manager service.
array
getTopics(int $tid, AccountInterface $account)
Gets list of forum topics.
protected array
getTopicOrder(int $sortby)
Gets topic sorting information based on an integer code.
protected int
lastVisit(int $nid, AccountInterface $account)
Gets the last time the user viewed a node.
protected object
getLastPost(int $tid)
Provides the last post information for the given forum tid.
protected object|null
getForumStatistics(int $tid)
Provides statistics for a forum.
array
getChildren(int $vid, int $tid)
Utility method to fetch the child forums for a given forum.
TermInterface
getIndex()
Generates and returns the forum index.
The forum index is a pseudo term that provides an overview of all forums.
resetCache()
Resets the ForumManager index and history.
bool
checkNodeType(NodeInterface $node)
Checks whether a node can be used in a forum, based on its content type.
The
unreadTopics(int $term, int $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.