Skip to content

Instantly share code, notes, and snippets.

View e2thex's full-sized avatar

Erik Summerfield e2thex

View GitHub Profile
@e2thex
e2thex / gist:2711570
Created May 16, 2012 15:56
What PHP fun fact make the use of $last here horribly wrong?
<?php
$output = '<div id="breadcrumb" class="clearfix"><ul class="breadcrumb">';
$switch = array('odd' => 'even', 'even' => 'odd');
$zebra = 'even';
$last = count($variables['breadcrumb']) - 1;
foreach ($variables['breadcrumb'] as $key => $item) {
$zebra = $switch[$zebra];
$attributes['class'] = array('depth-' . ($key + 1), $zebra);
@e2thex
e2thex / gist:2790471
Created May 25, 2012 20:49
ESI module flow
.------------------------.
| Page Call |
'------------------------'
|
v ____________________________
.---------. \ \
/ Call to \ \ ESI module ask plugin to \
( ESI PATH? )--------->) build content )
\ / / /
<?php
namespace Drupal\sps;
interface OverrideInterface {
/**
* construct an array of override arrays
*
* @return an array of override arrays
*/
public function getOverrides();
}
@e2thex
e2thex / classMap.asciio
Created June 28, 2012 13:08
Prposal for plugin hooks for sps module
@e2thex
e2thex / gist:3056240
Created July 5, 2012 20:27
web test not working
//class SPSDrupalVariableControllerUnitTest extends DrupalUnitTestCase {
class SPSDrupalVariableControllerUnitTest extends DrupalWebTestCase {
static function getInfo() {
return array(
'name' => 'SPS DrupalVariableController Unit Tests',
'description' => 'Test the public interface to the DrupalVariableController object',
'group' => 'SPS',
);
}
/**
13:43 /opt/development/esummerfield/lds/html/sites/all/modules/lsd_csi/sps (7.x-1.x) $ php /opt/development/esummerfield/lds/html/scripts/run-tests.s
h --color --verbose --class SPSPluginFactoryUnitTest
Drupal test run
---------------
Tests to be run:
- SPS Plugin Factory Unit Tests (SPSPluginFactoryUnitTest)
@e2thex
e2thex / gist:3091134
Created July 11, 2012 15:28
PluginFactory::checkPluginMeta
/**
* Recursive function to search the meta data
*
* @param $plugin_info
* @param $property
* this can be a string or a array of tree keys
* @param $value
*
* @return bool
*/
@e2thex
e2thex / gist:3098139
Created July 12, 2012 13:34
Plugin Factory validatePluginInfoElement
<?php
/**
* Validate that the plugin info array contains the all of the required keys
*
* @param $plugin_info
* @param $element_key
* @param $element
*
* @throws Exception\InvalidPluginException
*
.---------------------------------------------------.
|.-------------------------------------------------.|
|| [Select Condition] Date [__________] [submit] ||
|'-------------------------------------------------'|
| |
|.-----------------------------. .-----------------.|
||.---------------------------.| |.---------------.||
||| [Publish] || || [Publish] |||
||'---------------------------'| |'---------------'||
|| | | ||
@e2thex
e2thex / gist:3148658
Created July 20, 2012 04:16
sps_drupal()
<?php
namespace Drupal/sps
/**
* This is to assit in calling function outside of the sps
* module that might have side effect. It allows for test to
* change the function for there tests
* the syntax to use is