Skip to content

Instantly share code, notes, and snippets.

View adamzimmermann's full-sized avatar

Adam Zimmermann adamzimmermann

View GitHub Profile
@bojanz
bojanz / extension-patterns.md
Last active January 14, 2023 16:59
Extension patterns: events, tagged services, plugins

This documentation is destined for drupal.org. Created first as a gist to make initial comments easier. Rewrites and clarifications welcome. Code samples are simplified for clarity. Perhaps a bit too much?

When talking about extensibility, there are several distinct use cases:

  1. Reacting to an action that has already happened.

The reaction can be anything; outputting a message, sending an email, modifying a related object, etc. Examples:

  • "A node has been saved"
  • "A product has been added to the cart".
@typhonius
typhonius / seed_derivatives.drush.inc
Last active January 27, 2021 10:01
This script can generate image derivatives for Drupal for warming up the filesystem prior to going live. Image derivative generation puts an amount of load on the servers so it images have been migrated from another server with no derivatives, it may be useful to pre-generate using this script.
<?php
/**
* Implements hook_drush_command().
*/
function seed_derivatives_drush_command() {
$items = array();
$items['seed_derivatives'] = array(
'description' => "Create image derivatives",
<?php
// embed HTML 5 Video Player
// Standbild
$file_poster['filename'] = 'startbild.png';
$file_poster['filepath'] = 'sites/default/files/startbild.png';
// Webkit browser & Flash
$file_mp4['filename'] ='film_2.mp4';
$file_mp4['filemime'] = 'video/mp4';
$file_mp4['filepath'] = 'sites/default/files/film_2.mp4';