Skip to content

Instantly share code, notes, and snippets.

@szeidler
szeidler / mailchimp-increase-template-fetch-limit.patch
Created October 4, 2018 13:13
Increase mailchimp template fetch limit. Otherwise it will only fetch 10 templates per template group
diff --git a/modules/mailchimp_campaign/mailchimp_campaign.module b/modules/mailchimp_campaign/mailchimp_campaign.module
index c781162..2eda7c7 100644
--- a/modules/mailchimp_campaign/mailchimp_campaign.module
+++ b/modules/mailchimp_campaign/mailchimp_campaign.module
@@ -274,7 +274,7 @@ function mailchimp_campaign_list_templates($reset = FALSE) {
if ($chosen) {
$all_templates[$type] = array();
- $response = $mc_templates->getTemplates(array('type' => $type));
+ $response = $mc_templates->getTemplates(array('type' => $type, 'count' => 50));
@szeidler
szeidler / get-human-readable-node-bundle.php
Created December 20, 2018 11:59
Get the human-readable content type of a node object.
<?php
Drupal::config('node.type.' . $node->bundle())->get();
@szeidler
szeidler / ga_node_reports-add_sum_for_graph.patch
Created February 25, 2019 15:48
Add summed up numbers to ga_node_reports graph
diff --git a/ga_node_reports.pages.inc b/ga_node_reports.pages.inc
index f0eb797..8bc4426 100644
--- a/ga_node_reports.pages.inc
+++ b/ga_node_reports.pages.inc
@@ -39,6 +39,13 @@ function ga_node_reports_view_node_report($node) {
// Chart details building.
$chart_date = $chart_page = $chart_session = array();
+ // Sum up pageviews and sessions.
+ $sum = array('pageviews' => 0, 'sessions' => 0);
@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
@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 / 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 / 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();"
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 / 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
@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.