Skip to content

Instantly share code, notes, and snippets.

@szeidler
szeidler / gutenberg-regenerate-translations-file.patch
Created January 14, 2021 10:16
Regenerated translations file for Gutenberg 8.x-2.0-beta2, which was missing translations
diff --git a/js/drupal-gutenberg-translations.js b/js/drupal-gutenberg-translations.js
index c00f2f2..2ca1e3b 100644
--- a/js/drupal-gutenberg-translations.js
+++ b/js/drupal-gutenberg-translations.js
@@ -2,1212 +2,1750 @@
File generated by drupal-gutenberg-translations tool.
*/
/*
- Drupal.t('Field');
- Drupal.t('Field block.');
@szeidler
szeidler / rollback-module-update.sh
Created January 12, 2021 14:53
Rollback Drupal module schema version after update
#!/bin/bash
drush php-eval "drupal_set_installed_schema_version('your_module', 8001);"
@szeidler
szeidler / colordialog-d9-support-3135491-18.patch
Created September 7, 2020 14:19
D9 non-libraries support for colordialog
diff --git a/colordialog.info.yml b/colordialog.info.yml
index 090bf73..ccac3a3 100644
--- a/colordialog.info.yml
+++ b/colordialog.info.yml
@@ -2,7 +2,7 @@ name: CKEditor Color Dialog
type: module
description: "Adds in the Color Dialog plugin for CKEditor."
package: CKEditor
-core: 8.x
+core_version_requirement: ^8 || ^9
@szeidler
szeidler / ckeditor_fixed_toolbar-make_it_work_with_modal.patch
Last active May 12, 2020 09:47
Adds modal support for ckeditor_fixed_toolbar
diff --git a/js/plugins/fixed_toolbar/plugin.js b/js/plugins/fixed_toolbar/plugin.js
index 4a0757c..fa51d2e 100644
--- a/js/plugins/fixed_toolbar/plugin.js
+++ b/js/plugins/fixed_toolbar/plugin.js
@@ -8,6 +8,16 @@ CKEDITOR.plugins.add('fixed_toolbar', {
toolBar.style.position = 'sticky';
// We use the same offset as Drupal uses for body to make up for Admin Toolbar.
toolBar.style.top = document.body.style.paddingTop;
+
+ // Loop through the parents and see if we're in a modal.
@szeidler
szeidler / google_analytics_counter-missing_dependency_3093910-0.patch
Last active February 24, 2020 15:37
Add drupal:node dependency for google_analytics_counter
diff --git a/google_analytics_counter.info.yml b/google_analytics_counter.info.yml
index 661cd70..f032046 100644
--- a/google_analytics_counter.info.yml
+++ b/google_analytics_counter.info.yml
@@ -4,6 +4,8 @@ description: 'Lightweight page view counter drawing on data collected by Google
# core: 8.x
package: Statistics
configure: google_analytics_counter.admin_settings_form
+dependencies:
+ - drupal:node
diff --git a/src/Controller/GaNodeReportsCharts.php b/src/Controller/GaNodeReportsCharts.php
index 4d377f6..20bd319 100644
--- a/src/Controller/GaNodeReportsCharts.php
+++ b/src/Controller/GaNodeReportsCharts.php
@@ -113,6 +113,14 @@ class GaNodeReportsCharts extends ControllerBase implements ContainerInjectionIn
// Chart details building.
$chart_date = $chart_page = $chart_session = [];
+ // Sum up pageviews and sessions.
+ // We process the results twice, to reduce the chance of patch conflicts.
@szeidler
szeidler / run_update_hooks_again.sh
Created August 19, 2019 09:58
Programatically run update hooks again
#!/bin/bash
drush eval "module_load_install('mymodule'); mymodule_update_8010();"
@szeidler
szeidler / drupal-block_content-contextual_links-layout.builder.php
Created August 5, 2019 13:12
Make block_content contextual links available in Layout Builder blocks.
@szeidler
szeidler / display_suite_list_ds_fields_in_use.php
Created March 26, 2019 09:43
Track the Display Suite fields, that are in use on a Drupal site, to be able to remove the deprecated ones.
<?php
function ds_get_field_value($key, $field, $entity, $entity_type, $bundle, $view_mode, $build = array()) {
// …………………
// Track the display suite fields, that are in use.
$ds_fields = variable_get('my_active_ds_fields', array());
$render_key = $entity_type . ' | ' . $bundle . ' | ' . $view_mode;
if (isset($ds_fields[$key])) {
if (!in_array($render_key, $ds_fields[$key]['used_in'])) {
$ds_fields[$key]['used_in'][] = $render_key;
}
@szeidler
szeidler / composer-unlimited.sh
Created March 18, 2019 15:35
Runs a composer command without PHP memory limitations
#!/bin/bash
php -d memory_limit=-1 /usr/local/bin/composer