Drupal 7

Drupal 7: Decorate / wrap existing form as separate form with individual path

It's not an untypical situation: You'd like to use an existing Drupal CMS form as base for a custom form under a separate URL. In our example case we will decorate the Registration form "user_register_form" and create a separate registration form under a separate URL. This might be a custom alternative to modules like https://www.drupal.org/project/multiple_registration if they don't match your requirements.

How to track Google Ads conversions in Drupal (gtag.js) on specific pages

gtag.js Conversion Tracking in Drupal 7

My Drupal pro tip today only concerns Drupal 7 (sadly), because the tracking_code module is not available for Drupal 8 currently.

My little task was to add a Google Ads conversion tracking on a customer page. Google Ads uses gtag.js.

Drupal 7 / 8: Lightweight set / exchange domain specific front page (e.g. for landingpages)

Would you like to create a Landingpage for a specific topic in Drupal 7 / 8 on a separate landingpage domain (https://www.my-landingpage-example123.com/) as specific frontpage without using complex modules like Domain Access or multisite?
Then here's the lighweight way to go for you!

Drupal 7 redirect to fieldable-panels-panes after admin_menu Update

Today I'd like to share a nasty bug I ran into when updating a customer Drupal 7 CMS project. We updated several modules, one of them was admin_menu (7.x-3.0-rc5 > 7.x-3.0-rc6).
The website also used the "fieldable_panels_panes" module.

Einordnung:

Drupal 7 Snippet: Photoswipe: Only output first image of image field, but show the rest in swipe gallery

Simple snippet to only output the first image of an imagefield in a view and show the rest of the gallery in the photoswipe overlay.

Hint: Don't forget to add the photoswipe-gallery class on the field wrapper in views settings: http://cgit.drupalcode.org/photoswipe/tree/README.txt?h=7.x-2.x

  1. /**
  2.  * Implements hook_views_pre_render().
  3.  */

Drupal CMS + Google Analytics gaOptOut Datenschutz

Typischerweise wird in Datenschutzerklärungen Deutscher Websites ein JavaScript-Link zum OptOut aus Google Analytics angeboten, wie Websites wie folgende erläutern: https://die-netzialisten.de/wordpress/google-analytics-um-einen-optout-l...

In Kombination mit dem Google Analytics Drupal Modul

Drupal Addressfield Länder Kürzel Liste (z.B. für Feeds Import)

Falls ihr auch einmal Adressen via Feeds importieren möchtet, benötigt ihr für das Land im Addressfield sicher das Länderkürzel.

Nachfolgend findet ihr eine Deutsche Liste der vom Addressfield verwendeten Kürzel, die vermutlich dem ISO Standard entsprechen:

  • AF Afghanistan
  • AL Albanien
  • DZ Algerien
  • UM Amerikanisch-Ozeanien

Drupal hide fieldgroup in HOOK_form_alter

Drupal 7: Ensure HOOK_node_view is not called by search indexing

When using HOOK_node_view() you should take care because when the search (Search API especially) is indexing, this hook is also being called. You can not rely on a user displaying the node display currently. Here's a way to ensure this...

  1. function MYMODULE_node_view($node, $view_mode, $langcode) {
  2.   if ($view_mode != 'full' || arg(0) != 'node') {

Applying and maintaining Drupal patches efficiently

As Drupal developer you have to mess around with patches sometimes. Some of you might use Drupal module to manage their patches, some may use Git. Others may handle patches manually (which is the worst solution).

Einordnung: