Skip to content

Instantly share code, notes, and snippets.

View ao5357's full-sized avatar
🙂
Probably near my computer, probably something with emails

Brad Czerniak ao5357

🙂
Probably near my computer, probably something with emails
View GitHub Profile
@ao5357
ao5357 / WebformElement.php
Created June 15, 2022 13:38
A webform embed element for Acquia Site Studio, including dependency injection
<?php
namespace Drupal\webform_element\Plugin\CustomElement;
use Drupal\cohesion_elements\CustomElementPluginBase;
use Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException;
use Drupal\Component\Plugin\Exception\PluginNotFoundException;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
@ao5357
ao5357 / composer.lock
Created March 21, 2022 20:44
Manually patch guzzlehttp/psr7 to 1.8.5
{
"name": "guzzlehttp/psr7",
"version": "1.8.5",
"source": {
"type": "git",
"url": "https://github.com/guzzle/psr7.git",
"reference": "337e3ad8e5716c15f9657bd214d16cc5e69df268"
},
"dist": {
"type": "zip",
@ao5357
ao5357 / custom.js
Created December 15, 2021 17:32
Failed attempt to use a mutationObserver to replace a Drupal destination parameter on a use-ajax trigger link. The Drupal.ajax event listener registers it before the fix!
/**
* @file
* Global utilities.
*/
var michiganDesignInit = false; // Global scoped to track attachment just once.
(function($, Drupal) {
Drupal.behaviors.michigan_design = {
attach: function(context, settings) {
if (context === document && !michiganDesignInit) {
@ao5357
ao5357 / nypl_events_digital_displays.views.export.php
Created December 6, 2021 03:50
View for managing future d7 events for digital displays
$view = new view();
$view->name = 'nypl_events_digital_displays';
$view->description = 'Admin listings for events on digital displays';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'Digital Displays';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
@ao5357
ao5357 / externla-links.vanilla.js
Created September 30, 2021 18:26
Vanilla JS way to make external links not leak info to their destinations
@ao5357
ao5357 / tablefield_cellspan-allow_formatted.patch
Created August 4, 2021 14:34
Patch to 8.x-2.x tablefield module to allow cellspan in formatted cells
diff --git a/tablefield_cellspan/tablefield_cellspan.module b/tablefield_cellspan/tablefield_cellspan.module
index 8e343e1..d5b98ec 100644
--- a/tablefield_cellspan/tablefield_cellspan.module
+++ b/tablefield_cellspan/tablefield_cellspan.module
@@ -21,10 +21,6 @@ function tablefield_cellspan_preprocess_table(&$variables) {
foreach ($row['cells'] as $col_key => $cell) {
- if (is_array($cell['content']) || is_object($cell['content'])) {
- break;
@ao5357
ao5357 / token_remove-info-alter-contents_nypl.patch
Created July 9, 2021 20:28
Patch to remove the contents of a token hook for harmony on our d7 site
diff --git a/token.tokens.inc b/token.tokens.inc
index 3d65d6e..d562559 100644
--- a/token.tokens.inc
+++ b/token.tokens.inc
@@ -9,83 +9,7 @@
* Implements hook_token_info_alter().
*/
function token_token_info_alter(&$info) {
- // Force 'date' type tokens to require input and add a 'current-date' type.
- // @todo Remove when http://drupal.org/node/943028 is fixed.
@ao5357
ao5357 / behavior.js
Created June 20, 2021 19:32
Drupal theme javascript with a YouTube GA event tracker
/**
* @file
* JavaScript for this theme.
*/
/**
* Empty function the the YouTube iframe API requires.
*/
var youtubePlayers = [];
function onYouTubeIframeAPIReady() {
@ao5357
ao5357 / ckeditor-plugins-nypl.patch
Last active May 20, 2021 19:12
ckeditor patches for nypl D7 classic
From 6b72c5388c6457f285cde93edca508187fb40253 Mon Sep 17 00:00:00 2001
From: Brad Czerniak <[email protected]>
Date: Thu, 20 May 2021 14:51:09 -0400
Subject: [PATCH] RENO-2169 Include NYPL plugins in ckeditor
---
plugins/catalogimage/dialogs/catalogimage.js | 90 ++++++++++
plugins/catalogimage/images/catalogimage.png | Bin 0 -> 471 bytes
plugins/catalogimage/plugin.js | 136 +++++++++++++++
plugins/cataloglink/icons/cataloglink.png | Bin 0 -> 1150 bytes
@ao5357
ao5357 / views--7.x-comment-out-include.patch
Created May 18, 2021 19:24
Patch to comment out a views_include in 7.x
diff --git a/includes/plugins.inc b/includes/plugins.inc
index 8308e01c..5e62153b 100644
--- a/includes/plugins.inc
+++ b/includes/plugins.inc
@@ -6,7 +6,7 @@
*/
// @todo Remove this once update.php can use the registry.
-views_include('base');
+//views_include('base');