Change record status: 
Project: 
Introduced in branch: 
8.x
Introduced in version: 
8.0-ALPHA3
Description: 

A ForumManager service (id forum_manager) was added to allow a swappable back-end to forum functionality.
All internal forum functions (functions beginning with the _ prefix) were moved to methods on the manager.

API Changes

forum_forum_load() removed

forum_forum_load() was removed just use entity_load('taxonomy', $tid); instead.
The process of adding the forums, parents and topics properties to the forum have been split into three methods on the ForumManager, allowing this logic to be swapped out by replacing the service and sub-classing. This also allows a NoSql implementation as these methods rely heavily on SQL queries that cannot be converted to use Entity Field Queries.
Drupal 7

<?php
$forum
= forum_forum_load(1);
?>

Drupal 8
<?php
$forum
= entity_load('taxonomy_term', 1);
$forum_manager = Drupal::service('forum_manager');
$forum->forums = $forum_manager->getChildren(Drupal::config('forum.settings')->get('vocabulary'), $forum->id());
$forum->parents = $forum_manager->getParents($forum->id());
if (!
$forum->forum_container->value) {
 
$forum->topics = $forum_manager->getTopics($forum->id());
}
?>

Added a getIndex method

The special handling of the forum index (shown at /forum) has been moved to a dedicated method
Drupal 7

<?php
$forum_index
= forum_forum_load(0);
?>

Drupal 8
<?php
$manager
= Drupal::service('forum_manager');
$forum_index = $manager->getIndex();
?>

Again this can be swapped out for another implementation.

Forum 'container' property is a first-class field and no-longer stored in CMI

Previously identifying which forums vocabulary terms were containers (contain forums) and which were forums (contain posts) was done by storing those marked as containers in the variable system. In Drupal 8 prior to Alpha 3, this was also done using the CMI system (in the forum.settings.containers config object). This property has been moved to a (locked) configurable field, so is stored in the field tables like any other field. This breaks the dependency on the config system, as terms are a content entity and should not rely on the config system. With this change, forum containers and terms are deployable via REST endpoints like any other content entity.
Drupal 7

<?php
$containers
= variable_get('forum_containers', array());
$is_container = in_array($forum->tid, $containers);
?>

Drupal 8
<?php
$is_container
= $forum->forum_container->value;
?>

_forum_node_check_node_type removed

Drupal 7

<?php
$is_forum
= _forum_node_check_node_type($node);
?>

Drupal 8
<?php
$is_forum
= Drupal::service('forum_manager')->checkNodeType($node);
?>

_forum_update_forum_index() removed

Again this means index storage is swappable for non-SQL implementations.
Drupal 7

<?php
_forum_update_forum_index
($nid);
?>

Drupal 8
<?php
Drupal
::service('forum_manager')->updateIndex($node->id());
?>

Other internal API functions removed

_forum_user_last_visit() removed
_forum_topics_unread() removed
_forum_get_topic_order() removed
As each of these are only used in building the forum output (ForumManagerInterface::getChildren(), ForumManagerInterface::getParents(), ForumManagerInterface::getIndex(), ForumManagerInterface::getTopics()) these functions have been replaced with protected methods on the ForumManager service.
An alternate implementation can alter the logic of these functions, including their dependence on SQL.

forum_get_topics() removed

forum_get_topics removed use Drupal::service('forum_manager')->getTopics()
Drupal 7

<?php
$forum
->topics = forum_get_topics($forum->tid);
?>

Drupal 8
<?php
$forum
->topics = Drupal::service('forum_manager')->getTopics($forum->id());
?>

theme('forums') expects a term instead of a tid as an argument

Drupal 7

<?php
$build
= array(
 
'#theme' => 'forums',
 
'#forums' => $forums,
 
'#topics' => $topics,
 
'#parents' => $parents,
 
'#tid' => $term->tid,
 
'#sortby' => $sort_by,
 
'#forums_per_page' => $per_page,
);
?>

Drupal 8
<?php
$build
= array(
 
'#theme' => 'forums',
 
'#forums' => $forums,
 
'#topics' => $topics,
 
'#parents' => $parents,
 
'#term' => $term,
 
'#sortby' => $sort_by,
 
'#forums_per_page' => $per_page,
);
?>
Impacts: 
Module developers
Themers
Updates Done (doc team, etc.)
Online documentation: 
Not done
Theming guide: 
Not done
Module developer documentation: 
Not done
Examples project: 
Not done
Coder Review: 
Not done
Coder Upgrade: 
Not done
Other: 
Other updates done