Loading moderation_dashboard.install +32 −0 Original line number Diff line number Diff line Loading @@ -5,6 +5,9 @@ * Contains installation and update hooks for Moderation dashboard. */ use Drupal\Core\Config\FileStorage; use Drupal\page_manager\Entity\Page; /** * Creates the moderation_dashboard.settings config object. */ Loading Loading @@ -37,3 +40,32 @@ function moderation_dashboard_update_8101() { } } } /** * Upgrade from 1.x to 2.x. If views.view.moderation_dashboard exists nothing will run. If it does run it will reset the moderation_dashboard views. */ function moderation_dashboard_update_8102() { // Check if views.view.moderation_dashboard exists. If it does 2.x is probably installed. $check = \Drupal::configFactory()->getEditable('views.view.moderation_dashboard'); $message = 'views.view.moderation_dashboard existed nothing was needed'; if ($check->getOriginal('uuid') === NULL) { // First check that layout builder is installed. If not install it. $moduleHandler = \Drupal::service('module_handler'); if (!$moduleHandler->moduleExists('layout_builder')) { \Drupal::service('module_installer')->install(['layout_builder']); } // Second delete the page_manager moderation dashboard. $page_manage = Page::load('moderation_dashboard'); $page_manage?->delete(); // Lastly import the new configuration for working with layout builder. \Drupal::service('config.installer') ->installDefaultConfig('module', 'moderation_dashboard'); $message = 'views.view.moderation_dashboard did not exist module config was reimported'; } return $message; } Loading
moderation_dashboard.install +32 −0 Original line number Diff line number Diff line Loading @@ -5,6 +5,9 @@ * Contains installation and update hooks for Moderation dashboard. */ use Drupal\Core\Config\FileStorage; use Drupal\page_manager\Entity\Page; /** * Creates the moderation_dashboard.settings config object. */ Loading Loading @@ -37,3 +40,32 @@ function moderation_dashboard_update_8101() { } } } /** * Upgrade from 1.x to 2.x. If views.view.moderation_dashboard exists nothing will run. If it does run it will reset the moderation_dashboard views. */ function moderation_dashboard_update_8102() { // Check if views.view.moderation_dashboard exists. If it does 2.x is probably installed. $check = \Drupal::configFactory()->getEditable('views.view.moderation_dashboard'); $message = 'views.view.moderation_dashboard existed nothing was needed'; if ($check->getOriginal('uuid') === NULL) { // First check that layout builder is installed. If not install it. $moduleHandler = \Drupal::service('module_handler'); if (!$moduleHandler->moduleExists('layout_builder')) { \Drupal::service('module_installer')->install(['layout_builder']); } // Second delete the page_manager moderation dashboard. $page_manage = Page::load('moderation_dashboard'); $page_manage?->delete(); // Lastly import the new configuration for working with layout builder. \Drupal::service('config.installer') ->installDefaultConfig('module', 'moderation_dashboard'); $message = 'views.view.moderation_dashboard did not exist module config was reimported'; } return $message; }