diff --git a/blt/src/Blt/Plugin/Commands/HsHooksCommands.php b/blt/src/Blt/Plugin/Commands/HsHooksCommands.php index c4d24288d..f89e5d25b 100644 --- a/blt/src/Blt/Plugin/Commands/HsHooksCommands.php +++ b/blt/src/Blt/Plugin/Commands/HsHooksCommands.php @@ -19,6 +19,30 @@ public function preCodecepton() { $this->taskDrush()->drush('pmu')->arg('simplesamlphp_auth')->run(); } + /** + * Pre site update command. + * + * When deploying code to Acquia, before updating every site with configs, + * run database updates first to avoid any breaking issues. + * + * @hook pre-command artifact:update:drupal:all-sites + */ + public function preUpdateAllSites(){ + // Disable alias since we are targeting specific uri. + $this->config->set('drush.alias', ''); + + foreach ($this->getConfigValue('multisites') as $multisite) { + $this->switchSiteContext($multisite); + + if ($this->getInspector()->isDrupalInstalled()) { + $this->say("Running database updates on $multisite..."); + $this->taskDrush() + ->drush("updb") + ->run(); + } + } + } + /** * After a multisite is created, modify the drush alias with default values. * diff --git a/docroot/modules/humsci/hs_capx/src/Plugin/migrate_plus/data_parser/HSPubJson.php b/docroot/modules/humsci/hs_capx/src/Plugin/migrate_plus/data_parser/HSPubJson.php index 8ddc1fe61..a86864eea 100644 --- a/docroot/modules/humsci/hs_capx/src/Plugin/migrate_plus/data_parser/HSPubJson.php +++ b/docroot/modules/humsci/hs_capx/src/Plugin/migrate_plus/data_parser/HSPubJson.php @@ -17,7 +17,7 @@ class HSPubJson extends Json { /** * {@inheritDoc} */ - protected function getSourceData($url) { + protected function getSourceData(string $url): array { $source_data = parent::getSourceData($url); $modified_data = []; foreach ($source_data as $item) { diff --git a/docroot/modules/humsci/hs_courses/modules/hs_courses_importer/src/Plugin/migrate_plus/data_fetcher/CourseHttp.php b/docroot/modules/humsci/hs_courses/modules/hs_courses_importer/src/Plugin/migrate_plus/data_fetcher/CourseHttp.php index ae7869b7a..b7097ca61 100644 --- a/docroot/modules/humsci/hs_courses/modules/hs_courses_importer/src/Plugin/migrate_plus/data_fetcher/CourseHttp.php +++ b/docroot/modules/humsci/hs_courses/modules/hs_courses_importer/src/Plugin/migrate_plus/data_fetcher/CourseHttp.php @@ -30,7 +30,7 @@ class CourseHttp extends Http { /** * {@inheritdoc} */ - public function getResponseContent($url) { + public function getResponseContent(string $url): string { $response = $this->getResponse($url); $body = $response->getBody(); diff --git a/docroot/modules/humsci/hs_migrate/src/Plugin/migrate_plus/data_parser/HSLocalistJson.php b/docroot/modules/humsci/hs_migrate/src/Plugin/migrate_plus/data_parser/HSLocalistJson.php index fdfca2f30..c3c18e063 100644 --- a/docroot/modules/humsci/hs_migrate/src/Plugin/migrate_plus/data_parser/HSLocalistJson.php +++ b/docroot/modules/humsci/hs_migrate/src/Plugin/migrate_plus/data_parser/HSLocalistJson.php @@ -17,7 +17,7 @@ class HSLocalistJson extends Json { /** * {@inheritDoc} */ - protected function getSourceData($url) { + protected function getSourceData(string $url): array { $source_data = parent::getSourceData($url); $modified_data = []; foreach ($source_data as $item) { diff --git a/docroot/profiles/humsci/su_humsci_profile/modules/humsci_default_content/humsci_default_content.info.yml b/docroot/profiles/humsci/su_humsci_profile/modules/humsci_default_content/humsci_default_content.info.yml index 2c0dd2999..796d8777c 100644 --- a/docroot/profiles/humsci/su_humsci_profile/modules/humsci_default_content/humsci_default_content.info.yml +++ b/docroot/profiles/humsci/su_humsci_profile/modules/humsci_default_content/humsci_default_content.info.yml @@ -3,7 +3,7 @@ description: 'DO NOT INSTALL. This is for profile installation task only.' core_version_requirement: '^8.8 || ^9' hidden: true type: module -version: 9.3.15 +version: 9.3.16 default_content: block_content: - 2b7335a6-d3a4-468b-b515-9b1e2be558bc diff --git a/docroot/profiles/humsci/su_humsci_profile/modules/humsci_events_listeners/humsci_events_listeners.info.yml b/docroot/profiles/humsci/su_humsci_profile/modules/humsci_events_listeners/humsci_events_listeners.info.yml index 1a649e132..c2fea00a1 100644 --- a/docroot/profiles/humsci/su_humsci_profile/modules/humsci_events_listeners/humsci_events_listeners.info.yml +++ b/docroot/profiles/humsci/su_humsci_profile/modules/humsci_events_listeners/humsci_events_listeners.info.yml @@ -14,4 +14,4 @@ dependencies: - 'hook_event_dispatcher:toolbar_event_dispatcher' - 'hook_event_dispatcher:user_event_dispatcher' - 'hook_event_dispatcher:views_event_dispatcher' -version: 9.3.15 +version: 9.3.16 diff --git a/docroot/profiles/humsci/su_humsci_profile/su_humsci_profile.info.yml b/docroot/profiles/humsci/su_humsci_profile/su_humsci_profile.info.yml index 33561410e..e235ca5b8 100644 --- a/docroot/profiles/humsci/su_humsci_profile/su_humsci_profile.info.yml +++ b/docroot/profiles/humsci/su_humsci_profile/su_humsci_profile.info.yml @@ -1,7 +1,7 @@ name: 'Stanford HumSci' type: profile description: 'Installation profile for HumSci Drupal' -version: 9.3.15 +version: 9.3.16 core_version_requirement: '^8.8 || ^9' themes: - material_admin diff --git a/docroot/themes/humsci/humsci_basic/humsci_basic.theme b/docroot/themes/humsci/humsci_basic/humsci_basic.theme index c37dbce76..c370985e8 100644 --- a/docroot/themes/humsci/humsci_basic/humsci_basic.theme +++ b/docroot/themes/humsci/humsci_basic/humsci_basic.theme @@ -220,25 +220,24 @@ function humsci_basic_preprocess_pattern_vertical_link_card(&$variables) { * Implements hook_preprocess_HOOK() for we_megamenu li */ function humsci_basic_preprocess_we_megamenu_li(&$vars) { - $url = $vars['item']['url']; - - if (isset($vars['item']['route_name'])) { - $url = Url::fromUri('internal:'.$url); - } else { - $url = Url::fromUri($url); + if (empty($vars['href'])) { + return; + } + $host = \Drupal::request()->getSchemeAndHttpHost(); + $url = $vars['href']; + $alias = str_replace($host, '', $url); + if (substr($alias, 0, 1) != '/') { + return; + } + $path = \Drupal::service('path_alias.manager')->getPathByAlias($alias); + if (substr($path, 0, 6) != '/node/') { + return; } - if ($url->isRouted() && $url->getRouteName() == 'entity.node.canonical') { - $parameters = $url->getRouteParameters(); - $nid = $parameters['node']; - $node = Node::load($nid); - $type = $node->bundle(); - - if ($node) { - if ($type == 'hs_private_page') { - $vars['attributes']['class'][] = 'hb-private-page-link'; - } - } + [, $nid] = explode('/', trim($path, '/')); + $node = Node::load($nid); + if ($node && $node->bundle() == 'hs_private_page') { + $vars['attributes']['class'][] = 'hb-private-page-link'; } }