Skip to content

Instantly share code, notes, and snippets.

View swirtSJW's full-sized avatar

Steve Wirt swirtSJW

View GitHub Profile
@swirtSJW
swirtSJW / gist:49c5bf994023dd31e64b
Last active August 29, 2015 14:06
This is a variation of what I use to force ie to edge on a drupal site. I use it in Codit module. https://www.drupal.org/project/codit
/**
* Implements hook_init().
*/
function mymodule_init() {
// This is called on every page request (cached and non-cached).
mymodule_set_ie_to_edge();
}
@swirtSJW
swirtSJW / gist:e298ace654171d3120a1
Created September 23, 2014 18:51
Replace the existing hook_init with something like this... unless the existing init has other stuff in it. Then just move these items out.
/**
* Implements hook_boot().
*/
function local_framework_boot() {
// Set http header to force ie to edge mode to prevent compatibility-mode.
// This is the default behaviour. On all but prod set doj_theme_ie_to_edge=0.
if (!empty($_GET) && !empty($_GET['debug']) && ($_GET['debug'] == 'ie')) {
// There is a debug so do not force to use edge, do nothing.
}
else {
@swirtSJW
swirtSJW / MY_MODULE.module
Last active March 1, 2017 19:06
Drupal 7 Views output changes by QueryPath
<?php
// Moving lots of stuff (filters, counters, headers...) around in a View
// using QueryPath.
// Not quite the most Drupal-like, but actually much more reliable when it
// comes to inserting items into filters that are not covered by the Views UI
// and moving counters out of the header.
/**
* Implements hook_views_post_render().
*/
@swirtSJW
swirtSJW / FormManipulator.php
Created January 15, 2016 21:14
Drupal 7 FormManipulator for adding items or moving items in an Views Exposed Filter or form
<?php
/**
* @file
* Defines FormManipulator class for modifying a Drupal 7 Form.
*/
/**
* Class with methods for manipulating a Drupal 7 form.
*
* Current methods are
@swirtSJW
swirtSJW / ObtainLongPlainText.php
Created April 3, 2019 02:15
A Drupal migration_tools obtainer for finding long plain text.
<?php
namespace Drupal\migration_tools\Obtainer;
use Drupal\migration_tools\Obtainer\ObtainHtml;
use Drupal\migration_tools\StringTools;
/**
* Obtainers for Long Plain Text.
*

Keybase proof

I hereby claim:

  • I am swirtsjw on github.
  • I am stevewirt (https://keybase.io/stevewirt) on keybase.
  • I have a public key ASBpNTkcaMc6GNRb22wX0s1k09qi_aCILDpxWY6HqQ7X1Ao

To claim this, I am signing this object: