Skip to content

Instantly share code, notes, and snippets.

@seth-shaw-unlv
seth-shaw-unlv / islandora_local.module
Created May 20, 2022 20:10
Setting up ARKs as aliases
<?php
use Drupal\Core\Render\BubbleableMetadata;
/**
* Implements hook_token_info().
*/
function islandora_local_token_info() {
$type = [
'name' => t('Local'),
@seth-shaw-unlv
seth-shaw-unlv / generate-image-derivatives.php
Last active May 18, 2022 20:08
Islandora script for triggering new derivatives
<?php
use Drupal\system\Entity\Action;
use Drupal\Core\Session\UserSession;
use Drupal\user\Entity\User;
$userid = 1;
$account = User::load($userid);
$accountSwitcher = \Drupal::service('account_switcher');
$userSession = new UserSession([
@seth-shaw-unlv
seth-shaw-unlv / generate-image-derivatives.php
Created January 27, 2022 22:25
Script for mass triggering islandora derivatives where none exist.
<?php
use Drupal\system\Entity\Action;
use Drupal\Core\Session\UserSession;
use Drupal\user\Entity\User;
printf("STARTING:\t%d\n", time());
$userid = 3;
$account = User::load($userid);
$accountSwitcher = \Drupal::service('account_switcher');
$userSession = new UserSession([
@seth-shaw-unlv
seth-shaw-unlv / copyright-acknowledgement-demo.html
Created April 2, 2021 20:33
Demonstrates using a download form to gain acknowledgement of copyright and fair-use practices before downloading. Wraps it in a modal if JavaScript is enabled.
@seth-shaw-unlv
seth-shaw-unlv / example.md
Created February 20, 2021 04:51
D3.js Charts

Line Chart

Data (fig-1.csv)

item_count	stark	bartik	carapace	drupal8_parallax_theme
1462	3.074	3.251	3.480	3.160
107384	8.625	8.990	9.214	8.849
338947	19.573	17.215	17.740	17.272
@seth-shaw-unlv
seth-shaw-unlv / migrate_plus.migration.node.yml
Created March 26, 2020 15:35
Example migration using a parent child relationship based on parents using a base ID (e.g. 'did0001') and children with a padded integer appended with a hyphen (e.g. 'did0001-001' and 'did0001-002').
langcode: en
status: true
dependencies: { }
id: node
label: 'Nodes for paged content'
source:
plugin: csv
path: modules/my_module/metadata/nodes.csv
delimiter: ','
header_row_count: 1
@seth-shaw-unlv
seth-shaw-unlv / views.view.complex_object.yml
Last active May 7, 2019 14:53
Drupal 8 Complex Object Slideshow View for Islandora 8
langcode: en
status: true
dependencies:
config:
- field.storage.media.field_media_image
- field.storage.node.field_unlv_date_edtf
- media.type.image
module:
- controlled_access_terms
- eva