diff --git a/core/modules/field/field.api.php b/core/modules/field/field.api.php index 036a0bb..c133ad2 100644 --- a/core/modules/field/field.api.php +++ b/core/modules/field/field.api.php @@ -1699,7 +1699,7 @@ function hook_field_storage_pre_load($entity_type, $entities, $age, &$skip_field * Saved field UUIDs are set as keys in $skip_fields. */ function hook_field_storage_pre_insert(\Drupal\Core\Entity\EntityInterface $entity, &$skip_fields) { - if ($entity->entityType() == 'node' && $entity->status && Drupal::service('forum_manager')->checkNodeType(($entity)) { + if ($entity->entityType() == 'node' && $entity->status && Drupal::service('forum_manager')->checkNodeType($entity)) { $query = db_insert('forum_index')->fields(array('nid', 'title', 'tid', 'sticky', 'created', 'comment_count', 'last_comment_timestamp')); foreach ($entity->taxonomy_forums as $language) { foreach ($language as $delta) { @@ -1736,7 +1736,7 @@ function hook_field_storage_pre_insert(\Drupal\Core\Entity\EntityInterface $enti function hook_field_storage_pre_update(\Drupal\Core\Entity\EntityInterface $entity, &$skip_fields) { $first_call = &drupal_static(__FUNCTION__, array()); - if ($entity->entityType() == 'node' && $entity->status && Drupal::service('forum_manager')->checkNodeType(($entity)) { + if ($entity->entityType() == 'node' && $entity->status && Drupal::service('forum_manager')->checkNodeType($entity)) { // We don't maintain data for old revisions, so clear all previous values // from the table. Since this hook runs once per field, per entity, make // sure we only wipe values once. diff --git a/core/modules/forum/lib/Drupal/forum/Controller/ForumController.php b/core/modules/forum/lib/Drupal/forum/Controller/ForumController.php index a043c4c..b5e6ea4 100644 --- a/core/modules/forum/lib/Drupal/forum/Controller/ForumController.php +++ b/core/modules/forum/lib/Drupal/forum/Controller/ForumController.php @@ -14,6 +14,9 @@ use Drupal\taxonomy\VocabularyStorageControllerInterface; use Symfony\Component\DependencyInjection\ContainerInterface; +/** + * Provides controller for forum routes. + */ class ForumController implements ControllerInterface { /** @@ -26,7 +29,7 @@ class ForumController implements ControllerInterface { /** * Forum manager service. * - * @var Drupal\forum\ForumManager + * @var \Drupal\forum\ForumManager */ protected $forumManager; @@ -38,25 +41,7 @@ class ForumController implements ControllerInterface { protected $storageController; /** - * Vocabulary storage controller. - * - * @var \Drupal\taxonomy\VocabularyStorageControllerInterface - */ - - - /** - * Injects the ConfigFactory service to allow access to the forum settings. - */ - public static function create(ContainerInterface $container) { - return new static( - $container->get('config.factory'), - $container->get('forum_manager'), - $container->get('plugin.manager.entity')->getStorageController('taxonomy_vocabulary') - ); - } - - /** - * Constructor. + * Constructs a ForumController object. * * @param \Drupal\Core\Config\ConfigFactory $config_factory * The config factory. @@ -72,6 +57,17 @@ public function __construct(ConfigFactory $config_factory, ForumManager $forum_m } /** + * {@inheritdoc} + */ + public static function create(ContainerInterface $container) { + return new static( + $container->get('config.factory'), + $container->get('forum_manager'), + $container->get('plugin.manager.entity')->getStorageController('taxonomy_vocabulary') + ); + } + + /** * Returns forum page for a given forum. * * @param \Drupal\taxonomy\TermInterface $taxonomy_term @@ -107,6 +103,7 @@ public function forumPage(TermInterface $taxonomy_term) { '#sortby' => $this->config->get('topics.order'), '#forums_per_page' => $this->config->get('topics.page_limit'), ); + // @todo Make this a library - see https://drupal.org/node/2028113. $build['#attached']['css'][] = drupal_get_path('module', 'forum') . '/forum.css'; return $build; } @@ -137,6 +134,7 @@ public function forumIndex() { '#sortby' => $this->config->get('topics.order'), '#forums_per_page' => $this->config->get('topics.page_limit'), ); + // @todo Make this a library - see https://drupal.org/node/2028113. $build['#attached']['css'][] = drupal_get_path('module', 'forum') . '/forum.css'; return $build; } diff --git a/core/modules/forum/lib/Drupal/forum/ForumManager.php b/core/modules/forum/lib/Drupal/forum/ForumManager.php index 4e09265..ec7a9a6 100644 --- a/core/modules/forum/lib/Drupal/forum/ForumManager.php +++ b/core/modules/forum/lib/Drupal/forum/ForumManager.php @@ -479,10 +479,9 @@ public function getIndex() { } /** - * Overrides \Drupal\Core\Entity\DatabaseStorageController::resetCache(). + * Resets the ForumManager index and history. */ - public function resetCache(array $ids = NULL) { - parent::resetCache($ids); + public function resetCache() { // Reset the index. $this->index = NULL; // Reset history.