5 * Post update functions for the comment module.
8 use Drupal\Core\Config\FileStorage;
9 use Drupal\Core\Config\InstallStorage;
12 * Enable the comment admin view.
14 function comment_post_update_enable_comment_admin_view() {
15 $module_handler = \Drupal::moduleHandler();
16 $entity_type_manager = \Drupal::entityTypeManager();
18 // Save the comment delete action to config.
19 $config_install_path = $module_handler->getModule('comment')->getPath() . '/' . InstallStorage::CONFIG_INSTALL_DIRECTORY;
20 $storage = new FileStorage($config_install_path);
22 ->getStorage('action')
23 ->create($storage->read('system.action.comment_delete_action'))
26 // Only create if the views module is enabled.
27 if (!$module_handler->moduleExists('views')) {
31 // Save the comment admin view to config.
32 $optional_install_path = $module_handler->getModule('comment')->getPath() . '/' . InstallStorage::CONFIG_OPTIONAL_DIRECTORY;
33 $storage = new FileStorage($optional_install_path);
36 ->create($storage->read('views.view.comment'))