Skip to content

Commit

Permalink
9.3.16
Browse files Browse the repository at this point in the history
- Added blt hook to run database updates before config importing
- Fix preprocess megamenu breaking
- Fix migrate typecasting in classes
  • Loading branch information
pookmish authored May 13, 2022
2 parents 1703ada + 119ba86 commit 3f3afe9
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 23 deletions.
24 changes: 24 additions & 0 deletions blt/src/Blt/Plugin/Commands/HsHooksCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 <comment>$multisite</comment>...");
$this->taskDrush()
->drush("updb")
->run();
}
}
}

/**
* After a multisite is created, modify the drush alias with default values.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
@@ -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
Expand Down
33 changes: 16 additions & 17 deletions docroot/themes/humsci/humsci_basic/humsci_basic.theme
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
}

Expand Down

0 comments on commit 3f3afe9

Please sign in to comment.