Skip to content

Commit

Permalink
Merge branch '11.7.1-release' of github.com:SU-HSDO/suhumsci into shs…
Browse files Browse the repository at this point in the history
…-6029--reviewer-role
  • Loading branch information
cienvaras committed Feb 11, 2025
2 parents 3d9a95b + a0b5c04 commit 71b872a
Show file tree
Hide file tree
Showing 65 changed files with 1,464 additions and 824 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ docroot/themes/humsci/humsci_colorful/css/humsci_colorful-ckeditor.css
docroot/themes/humsci/humsci_traditional/css/humsci_traditional-ckeditor.css
docroot/themes/humsci/humsci_colorful/css/humsci_colorful-preview.css
docroot/themes/humsci/humsci_traditional/css/humsci_traditional-preview.css
docroot/themes/humsci/humsci_traditional/js/index.js
docroot/themes/humsci/humsci_colorful/js/index.js
docroot/themes/humsci/humsci_basic/dist/js
docroot/themes/humsci/humsci_traditional/js
docroot/themes/humsci/humsci_colorful/js
# Ignore build artifacts
deployment_identifier
/deploy
Expand Down
8 changes: 8 additions & 0 deletions docroot/modules/humsci/hs_layouts/hs_layouts.libraries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ three_column_w_image:
css:
layout:
css/three-column-w-image.css: {}

news_style:
css:
layout:
css/news-style.css: {}

layout_builder_admin:
css:
theme:
Expand All @@ -19,3 +21,9 @@ images_loaded:
//imagesloaded.desandro.com/imagesloaded.pkgd.min.js: {type: external, minified: true }
dependencies:
- core/jquery

layout-builder-vertical-tabs:
js:
js/layout-builder-vertical-tabs.js: {}
dependencies:
- core/drupal
13 changes: 12 additions & 1 deletion docroot/modules/humsci/hs_layouts/hs_layouts.module
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ function hs_layouts_plugin_filter_block__layout_builder_alter(&$definitions, &$e
}
}

/**
* Implements hook_preprocess_HOOK().
*/
function hs_layouts_preprocess_page(&$variables) {
// Load layout-builder-vertical-tabs lib in the layout builder override form.
if (\Drupal::routeMatch()->getRouteName() == 'layout_builder.overrides.node.view') {
$variables['#attached']['library'][] = 'hs_layouts/layout-builder-vertical-tabs';
}
}

/**
* Implements hook_preprocess().
*/
Expand Down Expand Up @@ -182,9 +192,10 @@ function _hs_layouts_make_title_the_link(&$variables) {
$variables['href'] = $variables['href'] ?? htmlspecialchars_decode(trim(strip_tags($renderer->renderInIsolation($variables['button']))));
}
}

if (!empty($variables['title'])) {
$title = is_array($variables['title']) ? $renderer->renderInIsolation($variables['title']) : $variables['title'];
$variables['title'] = ['#markup' => trim(strip_tags($title))];
$variables['title'] = $title ?? ['#markup' => trim(strip_tags($title))];
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function closeDetails() {
// Close Revision Information Details element in Layout Builder by default.
// Close Revision Information Details element in Layout Builder by default.
if (document.querySelector('.layout-builder-form')) {
const details = document.querySelector('.layout-builder-form details');
if (details) {
Expand Down
60 changes: 54 additions & 6 deletions docroot/modules/humsci/hs_migrate/hs_migrate.install
Original file line number Diff line number Diff line change
Expand Up @@ -99,19 +99,61 @@ function hs_migrate_update_8007() {
'hs_d7_news',
];

$schema = \Drupal::database()->schema();
$logger = \Drupal::logger('hs_migrate');

// Get site path to prevent removing hs_d7_news from MRC.
$site_path = \Drupal::getContainer()->getParameter('site.path');
$is_mrc = $site_path == 'sites/mrc';

foreach ($unused_importers as $importer) {
// Remove hs_d7_news for MRC.
if ($is_mrc) {
$unused_importers = array_diff($unused_importers, ['hs_d7_news']);
}

if ($is_mrc && $importer == 'hs_d7_news') {
continue;
_hs_migrate_remove_importers($unused_importers);
}

/**
* Remove unused importers.
*/
function hs_migrate_update_8008() {
$unused_importers = [
'custm_art_work',
'custm_finance_department',
'custm_finance_resource',
'custm_mrc_events',
'custm_mrc_news',
'custm_mrc_terms',
'custm_mrc_visitors',
];

_hs_migrate_remove_importers($unused_importers);
}

/**
* Deletes importer configuration and drops migration tables.
*
* This function takes either a single string or an array of importer names as
* strings, removes their configuration, migration tables, and logs the results.
*
* @param string|string[] $input
* A single string or an array of importer names to process.
*
* @throws \InvalidArgumentException
* When the input is neither a string nor an array of strings.
*/
function _hs_migrate_remove_importers(string|array $input): void {
// Convert single string to array for consistent processing.
$importers = is_array($input) ? $input : [$input];

// Validate all elements are strings.
foreach ($importers as $importer) {
if (!is_string($importer)) {
throw new \InvalidArgumentException(
'All elements in the input array must be strings.'
);
}
}

foreach ($importers as $importer) {
// Verify migration entity exists.
$migration = \Drupal::entityTypeManager()
->getStorage('migration')
Expand All @@ -121,6 +163,12 @@ function hs_migrate_update_8007() {
continue;
}

// Initialize logger and schema for the first importer found.
if (!isset($logger)) {
$logger = \Drupal::logger('hs_migrate');
$schema = \Drupal::database()->schema();
}

// Remove migration importer configuration.
$migration->delete();
$message = t('Deleted @config', [
Expand Down
4 changes: 3 additions & 1 deletion docroot/themes/humsci/humsci_basic/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
"node": true
},
"globals": {
"Drupal": "readonly"
"Drupal": "readonly",
"jQuery": "readonly",
"once": "readonly"
},
"rules": {
"no-restricted-globals": 0,
Expand Down
12 changes: 5 additions & 7 deletions docroot/themes/humsci/humsci_basic/humsci_basic.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ description: A base for visually distinctive HumSci themes.
package: 'Humanities & Sciences'
core_version_requirement: ^9.4 || ^10
'base theme': stable9
# libraries: Libraries are loaded via sub-themes
dependencies:
- hs_layouts:hs_layouts
libraries:
- humsci_basic/main-content-fallback
- humsci_basic/editoria11y

regions:
page_top: 'Page top'
Expand All @@ -27,9 +31,3 @@ libraries-override:
css:
layout:
css/three-column-w-image.css: false

# we_megamenu/form.we-mega-menu-frontend:
# css:
# theme:
# assets/css/we_megamenu_backend.css: false
# assets/includes/bootstrap/css/bootstrap.min.css: false
131 changes: 130 additions & 1 deletion docroot/themes/humsci/humsci_basic/humsci_basic.libraries.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,132 @@
accordion:
js:
dist/js/accordion.js: {}
dependencies:
- core/drupal
- core/once

addtocal:
js:
dist/js/addtocal.js: {}
dependencies:
- core/drupal
- core/once

carousel-slides-height:
js:
dist/js/carousel-slides-height.js: {}
dependencies:
- core/drupal
- core/once

colorbox:
js:
dist/js/colorbox.js: {}
dependencies:
- core/drupal
- core/once

editoria11y:
js:
dist/js/editoria11y.js: {}
dependencies:
- core/drupal
- core/once

equal-height-grid:
js:
dist/js/equal-height-grid.js: {}
dependencies:
- core/drupal
- core/once

linked-cards:
js:
dist/js/linked-cards.js: {}
dependencies:
- core/drupal
- core/once

main-content-fallback:
js:
dist/js/main-content-fallback.js: {}
dependencies:
- core/drupal
- core/once

main-menu:
js:
dist/js/main-menu.js: {}
dependencies:
- core/drupal
- core/once

megamenu:
js:
dist/js/megamenu.js: {}
dependencies:
- core/drupal
- core/once

page-scroll-animations:
js:
dist/js/page-scroll-animations.js: {}
dependencies:
- core/drupal
- core/once

prefered-reduced-motion:
js:
dist/js/prefered-reduced-motion.js: {}
dependencies:
- core/drupal
- core/once

search:
js:
src/js/shared/search/search-expand.js: {}
dist/js/search.js: {}
dependencies:
- core/drupal
- core/once

secondary-menu:
js:
dist/js/secondary-toggler.js: {}
dependencies:
- core/drupal
- core/once

table-pattern:
js:
dist/js/table-pattern.js: {}
dependencies:
- core/drupal
- core/once

table-scope:
js:
dist/js/table-scope.js: {}
dependencies:
- core/drupal
- core/once

table-wrap:
js:
dist/js/table-wrap.js: {}
dependencies:
- core/drupal
- core/once

timeline:
js:
dist/js/timeline.js: {}
dependencies:
- core/drupal
- core/once

video-with-caption:
js:
dist/js/video-with-caption.js: {}
dependencies:
- core/drupal
- core/once
20 changes: 19 additions & 1 deletion docroot/themes/humsci/humsci_basic/humsci_basic.theme
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,6 @@ function humsci_basic_preprocess_we_megamenu_frontend(&$vars) {
*/
function humsci_basic_preprocess_views_view(&$variables) {
$view = $variables['view'];

switch ($view->id()) {
case 'hs_default_search':
$variables['#attached']['library'][] = 'humsci_basic/search';
Expand Down Expand Up @@ -251,3 +250,22 @@ function humsci_basic_preprocess_paragraph(&$variables) {
}
$variables['content']['field_hs_view'][0]['#heading_tag'] = $heading_tag;
}

/**
* Implements hook_preprocess_HOOK().
*/
function humsci_basic_preprocess_field(&$variables) {
$wysiwyg_types = ['text_long', 'text_with_summary'];
if (in_array($variables['field_type'], $wysiwyg_types)) {
$variables['#attached']['library'][] = 'humsci_basic/table-wrap';
$variables['#attached']['library'][] = 'humsci_basic/table-scope';
$variables['#attached']['library'][] = 'humsci_basic/page-scroll-animations';
}
}

/**
* Implements hook_preprocess_ENTITY__BUNDLE().
*/
function humsci_basic_preprocess_node__hs_event(&$variables) {
$variables['#attached']['library'][] = 'humsci_basic/addtocal';
}
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
import '../shared/index';

// Add Colorful and Airy specific JS below
Loading

0 comments on commit 71b872a

Please sign in to comment.