Skip to content
Snippets Groups Projects
Commit dc11fb9a authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2301247 by mitsuroseba | andypost: Make comments for forum non-threaded by default.

parent 8ca9d2af
No related branches found
No related tags found
No related merge requests found
......@@ -6,7 +6,9 @@
*/
use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface;
use Drupal\field\Entity\FieldInstanceConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\comment\CommentManagerInterface;
/**
* Implements hook_install().
......@@ -87,6 +89,12 @@ function forum_install() {
));
if (empty($field_storages)) {
Drupal::service('comment.manager')->addDefaultField('node', 'forum', 'comment_forum', CommentItemInterface::OPEN, 'comment_forum');
// Add here because we don't have param in addDefaultField function.
$instance = FieldInstanceConfig::loadByName('node', 'forum', 'comment_forum');
$instance->settings['default_mode'] = CommentManagerInterface::COMMENT_MODE_FLAT;
$instance->save();
// Hide label for comment field.
entity_get_display('node', 'forum', 'default')
->setComponent('comment_forum', array(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment