diff --git a/core/modules/comment/comment.post_update.php b/core/modules/comment/comment.post_update.php index 04bf2db28d..14d8f423e2 100644 --- a/core/modules/comment/comment.post_update.php +++ b/core/modules/comment/comment.post_update.php @@ -36,3 +36,25 @@ function comment_post_update_enable_comment_admin_view() { ->create($storage->read('views.view.comment')) ->save(); } + +/** + * Update the comment admin view. + */ +function comment_post_update_update_comment_admin_view() { + $module_handler = \Drupal::moduleHandler(); + $entity_type_manager = \Drupal::entityTypeManager(); + + // Only update if the views module is enabled. + if (!$module_handler->moduleExists('views')) { + return; + } + + // Save the comment admin view to config. + $optional_install_path = $module_handler->getModule('comment')->getPath() . '/' . InstallStorage::CONFIG_OPTIONAL_DIRECTORY; + $storage = new FileStorage($optional_install_path); + $entity_type_manager + ->getStorage('view') + ->create($storage->read('views.view.comment')) + ->save(); + +}