Skip to content

Instantly share code, notes, and snippets.

View keybase.md

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:

@swirtSJW
swirtSJW / ObtainLongPlainText.php
Created Apr 3, 2019
A Drupal migration_tools obtainer for finding long plain text.
View ObtainLongPlainText.php
<?php
namespace Drupal\migration_tools\Obtainer;
use Drupal\migration_tools\Obtainer\ObtainHtml;
use Drupal\migration_tools\StringTools;
/**
* Obtainers for Long Plain Text.
*
@swirtSJW
swirtSJW / FormManipulator.php
Created Jan 15, 2016
Drupal 7 FormManipulator for adding items or moving items in an Views Exposed Filter or form
View FormManipulator.php
<?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 / MY_MODULE.module
Last active Mar 1, 2017
Drupal 7 Views output changes by QueryPath
View MY_MODULE.module
<?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 / gist:e298ace654171d3120a1
Created Sep 23, 2014
Replace the existing hook_init with something like this... unless the existing init has other stuff in it. Then just move these items out.
View gist:e298ace654171d3120a1
/**
* 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 / gist:49c5bf994023dd31e64b
Last active Aug 29, 2015
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
View gist:49c5bf994023dd31e64b
/**
* Implements hook_init().
*/
function mymodule_init() {
// This is called on every page request (cached and non-cached).
mymodule_set_ie_to_edge();
}