Skip to content

Commit

Permalink
Merge branch 'main' into BCELN24MIG-193
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismacdonaldw authored Oct 15, 2024
2 parents 8c5aeb1 + 3e69831 commit 3cac2c2
Show file tree
Hide file tree
Showing 17 changed files with 1,007 additions and 190 deletions.
5 changes: 5 additions & 0 deletions bcelndora.libraries.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
theme_overrides:
version: VERSION
css:
theme:
scss/styles.scss: {}
98 changes: 98 additions & 0 deletions bcelndora.module
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<?php

/**
* @file
* bcelndora.module
*/

use Drupal\scss_compiler\ScssCompilerAlterStorage;
use Symfony\Component\Routing\Generator\UrlGenerator;

/**
* Implements hook_theme_suggestions_alter().
*/
function bcelndora_theme_suggestions_alter(array &$suggestions, array $variables, $hook) {
// Add a views template suggestion for the taxonomy term 'person' vocab.
if (in_array($hook, ['views_view'])) {
$parameters = \Drupal::routeMatch()->getParameters()->all();
if (isset($parameters['taxonomy_term'])) {
$term = $parameters['taxonomy_term'];
$vid = $term->bundle();
$vocabulary = \Drupal::entityTypeManager()->getStorage('taxonomy_vocabulary')->load($vid);
if ($vocabulary->getOriginalId() === "person") {
$suggestions[] = $hook . '__' . 'taxonomy_term__person';
}
}
}
}

/**
* Implements hook_theme().
*/
function bcelndora_theme($existing, $type, $theme, $path) {
return [
'views_view__taxonomy_term__person' => [
'template' => 'views-view--taxonomy-term--person',
'base hook' => 'views_view',
],
];
}

/**
* Implements hook_scss_compiler_import_paths_alter().
*/
function bcelndora_scss_compiler_import_paths_alter(array &$additional_import_paths) {
$theme_list = \Drupal::service('extension.list.theme');
$file_system = \Drupal::service('file_system');
$additional_import_paths[] = $file_system->realpath($theme_list->getPath('dgi_i8_base')) . "/scss/";
}

/**
* Implements hook_scss_compiler_variables_alter().
*/
function bcelndora_scss_compiler_variables_alter(ScssCompilerAlterStorage $storage) {
if (function_exists('dgi_i8_base_scss_compiler_variables_alter')) {
dgi_i8_base_scss_compiler_variables_alter($storage);
}

$theme_list = \Drupal::service('extension.list.theme');
$theme_path = $theme_list->getPath('dgi_i8_base');
$module_list = \Drupal::service('extension.list.module');
$module_path = $module_list->getPath('bcelndora');

/** @var \Drupal\scss_compiler\ScssCompilerInterface $scss_compiler */
$scss_compiler = \Drupal::service('scss_compiler');
$upstream = $storage->getByFile($scss_compiler->replaceTokens('@dgi_i8_base/scss/style.scss'));

$to_set = array_merge(
$upstream,
[
'theme-path' => UrlGenerator::getRelativePath("/{$module_path}/", "/{$theme_path}"),
],
);

$storage->setByFile($to_set, '@bcelndora/scss/styles.scss');
}

/**
* Implements hook_page_attachments().
*
* Attach AUC specific base theme overrides via the module library.
*/
function bcelndora_page_attachments(array &$page) {
if (\Drupal::theme()->getActiveTheme()->getName() === "dgi_i8_base") {
$page['#attached']['library'][] = 'bcelndora/theme_overrides';
}
}

/**
* Implements hook_library_info_alter().
*
* Unset the theme's 'framework' library CSS, as this module provides its own
* via this module's 'hook_page_attachments' implementation.
*/
function bcelndora_library_info_alter(&$libraries, $extension) {
if ($extension == 'dgi_i8_base' && isset($libraries['framework']['css']['theme']['scss/style.scss'])) {
unset($libraries['framework']['css']['theme']['scss/style.scss']);
}
}
36 changes: 36 additions & 0 deletions migrations/bceln_ccl_4_0_terms.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
id: bceln_ccl_4_0_terms
label: 'BCELNDora Creative Commons Licenses 4.0 terms'
migration_group: islandora
migration_tags:
- dgi_taxonomies
source:
plugin: embedded_data
track_changes: true
data_rows:
- name: 'Public Domain Mark 1.0 Universal'
vid: 'creative_commons_licenses_4_0'
url: 'https://creativecommons.org/publicdomain/mark/1.0/'
- name: 'CC0 1.0 Universal'
vid: 'creative_commons_licenses_4_0'
url: 'https://creativecommons.org/publicdomain/zero/1.0/'
ids:
name:
type: string
process:
tid:
- plugin: entity_lookup
source: name
entity_type: taxonomy_term
value_key: name
bundle_key: vid
bundle: creative_commons_licenses_4_0
- plugin: skip_on_empty
method: process
name: name
vid: vid
field_url: url
destination:
plugin: 'entity:taxonomy_term'
default_bundle: creative_commons_licenses_4_0
migration_dependencies:
required: []
31 changes: 31 additions & 0 deletions migrations/bceln_stub_terms_institution.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
id: bceln_stub_terms_institution
label: Create stub institution terms.
migration_group: foxml_to_dgis
source:
plugin: embedded_data
data_rows: []
ids:
institution:
type: string
dsf_misc:
type: &type entity:taxonomy_term
bundle: &bundle institution
destination:
plugin: *type
default_bundle: *bundle
# XXX: We're not really dealing with translations here. To do so, seems like
# you would need separate migrations.
#translations: true
validate: &validate false
overwrite_properties: []
process:
name:
- plugin: get
source: institution

dependencies:
enforced:
module:
- dgi_migrate
- dgi_migrate_foxml_standard_mods
Loading

0 comments on commit 3cac2c2

Please sign in to comment.