Skip to content

Instantly share code, notes, and snippets.

View omahm's full-sized avatar

Steve Cousins omahm

View GitHub Profile
@omahm
omahm / ob_get_clean.patch
Created November 3, 2022 14:51
Fixes issue: PHP Fatal error: ob_get_clean(): Cannot use output buffering in output buffering display handlers in /app/vendor/twig/twig/src/Template.php
diff --git src/TwigTweakExtension.php src/TwigTweakExtension.php
index d007798..072c953 100644
--- src/TwigTweakExtension.php
+++ src/TwigTweakExtension.php
@@ -703,9 +703,7 @@ class TwigTweakExtension extends AbstractExtension {
ob_start();
// phpcs:ignore Drupal.Functions.DiscouragedFunctions.Discouraged
print eval($code);
- $output = ob_get_contents();
- ob_end_clean();
diff --git a/flag.module b/flag.module
index 8dd6181..545ad1b 100644
--- a/flag.module
+++ b/flag.module
@@ -180,9 +180,11 @@ function flag_form_alter(&$form, FormStateInterface $form_state, $form_id) {
];
}
- foreach (array_keys($form['actions']) as $action) {
- if ($action != 'preview' && isset($form['actions'][$action]['#type']) && $form['actions'][$action]['#type'] === 'submit') {
diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/StringFormatter.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/StringFormatter.php
index 96f18958..ff5f30fa 100644
--- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/StringFormatter.php
+++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/StringFormatter.php
@@ -181,6 +181,13 @@ protected function getEntityUrl(EntityInterface $entity) {
// 'canonical'.
// @see \Drupal\Core\Entity\Entity::toUrl()
$rel = $entity->getEntityType()->hasLinkTemplate('revision') ? 'revision' : 'canonical';
+
+ // If this is not the default revision and is the latest translation
@omahm
omahm / cacheableAjaxResponse.patch
Last active April 26, 2021 13:11
Patch to enable cached Ajax responses.
diff --git a/core/lib/Drupal/Core/Cache/CacheableAjaxResponse.php b/core/lib/Drupal/Core/Cache/CacheableAjaxResponse.php
new file mode 100644
index 0000000000..996e674d8e
--- /dev/null
+++ b/core/lib/Drupal/Core/Cache/CacheableAjaxResponse.php
@@ -0,0 +1,21 @@
+<?php
+
+namespace Drupal\Core\Cache;
+
diff --git a/clientside_validation_jquery/js/cv.jquery.validate.js b/clientside_validation_jquery/js/cv.jquery.validate.js
index a6cc18c..f22e430 100644
--- a/clientside_validation_jquery/js/cv.jquery.validate.js
+++ b/clientside_validation_jquery/js/cv.jquery.validate.js
@@ -60,7 +60,9 @@
$(document).trigger('cv-jquery-validate-options-update', drupalSettings.cvJqueryValidateOptions);
$(document).find('form').each(function() {
- $(this).validate(drupalSettings.cvJqueryValidateOptions);
+ if (typeof $(this).validate === "function") {
@omahm
omahm / gac_query_options.patch
Last active February 3, 2020 15:19
Adds query parameter options to Drupal Google Analytics Counter module
diff --git a/src/Form/GoogleAnalyticsCounterSettingsForm.php b/src/Form/GoogleAnalyticsCounterSettingsForm.php
index 6854726..baf925b 100755
--- a/src/Form/GoogleAnalyticsCounterSettingsForm.php
+++ b/src/Form/GoogleAnalyticsCounterSettingsForm.php
@@ -241,6 +241,28 @@ class GoogleAnalyticsCounterSettingsForm extends ConfigFormBase {
],
];
+ // Google Analytics API query overrides.
+ $form['query_properties'] = [
@omahm
omahm / d7_views_list.php
Last active May 16, 2019 08:31
List all Drupal 7 Views and Displays
<?php
$views = views_get_all_views();
ksort($views);
foreach ($views as $view) {
echo $view->name . "\r\n";
foreach($view->display as $display) {
echo "-- " . $display->display_title . "\r\n";
}
@omahm
omahm / foundation_6_laravel_mix
Created July 14, 2018 16:50
Patch for Zurb Foundation 6 and Laravel Mix
diff --git a/scss/settings/_settings.scss b/scss/settings/_settings.scss
index 1beef40..5f501c7 100644
--- a/scss/settings/_settings.scss
+++ b/scss/settings/_settings.scss
@@ -41,7 +41,7 @@
// 36. Tooltip
// 37. Top Bar
-@import 'util/util';
+@import '../util/util';
var gulp = require('gulp');
var sass = require('gulp-sass');
var plumber = require('gulp-plumber');
var gutil = require('gulp-util');
var notify = require("gulp-notify");
// Error notification
function error_notify(error){
notify.onError({title: "Gulp Error", message: error.message})(error);
console.log(error.toString());