Skip to content

Instantly share code, notes, and snippets.

View bangpound's full-sized avatar

Benjamin Doherty bangpound

View GitHub Profile
<?php
/**
*
*/
class tsccivicrm_handler_field_primary_phone extends views_handler_field {
function option_definition() {
$options = parent::option_definition();
@bangpound
bangpound / social_media_share.module.php
Created April 14, 2011 21:55
exposes share links using social media APIs.
<?php
function XXX_node_view($node, $view_mode, $langcode) {
if ($view_mode == 'full' && in_array($node->type, array('blog', 'release', 'report', 'review', 'story'))) {
// http://dev.twitter.com/pages/tweet_button
$links['twitter'] = array(
'title' => t('Tweet'),
'href' => 'http://twitter.com/share',
'attributes' => array(
@bangpound
bangpound / gist:1390085
Created November 23, 2011 22:15
override media filter to show full file entities not just file field
<?php
/**
* Implement hook_filter_info_alter().
*/
function whatsit_filter_info_alter(&$info) {
$info['media_filter']['process callback'] = 'whatsit_media_filter';
}
@bangpound
bangpound / roadmap.html
Created November 29, 2011 06:24
Roadmap to Dispossession
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title></title>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<meta name="description" content="" />
<meta name="keywords" content="" />
<link href="main.css" rel="stylesheet" type="text/css" />
<style type="text/css">
#march li {
@bangpound
bangpound / gist:1506800
Created December 21, 2011 17:09
Make Drupal 7 aggregation efficient again and use Google CDN for jQuery and jQuery UI
<?php
/**
* Implements hook_library().
*/
function MYMODULE_library() {
// jQuery UI from Google.
$libraries['ui'] = array(
'title' => 'jQuery UI: All',
'website' => 'http://jqueryui.com',
@bangpound
bangpound / README.md
Created January 17, 2012 14:48 — forked from anonymous/README.md
Timed sopa/pipa strike blackout: Same as the sopablackout.org script, but only if today's 2012-18-1

The sopastrike.com script rocks, but you have to get up early on Wednesday and add it to all your sites, so what kind of strike is it if you have to work hard on that day? :)

Just add

<script type="text/javascript" src="//pastebin.com/raw.php?i=bip80DLx"></script>

somewhere between your <head> and </head>, and sleep late on Wednesday.

If you're using wordpress, do that at

<?php
/**
* Implement hook_form_FORMID_alter().
*/
function MODULE_form_blog_node_form_alter(&$form, &$form_state) {
// Change label of save button.
$form['buttons']['submit']['#value'] = t('Post');
<?php
/**
* FormAPI theme function. Theme the output of an image field.
*/
function theme_imagefield_widget($element) {
if ($element['#field_name'] == 'FIELD_WHATEVER' && $element['#type_name'] == 'soy_poderosa_photo') {
$element['data']['title']['#title'] = t('The better title just for this field on this node type.');
}
drupal_add_css(drupal_get_path('module', 'imagefield') .'/imagefield.css');
function nlirh_imagefield_widget($element) {
if ($element['#field_name'] == 'field_soy_poderosa_photo' && $element['#type_name'] == 'soy_poderosa_photo') {
print "WTF!";
$element['data']['title']['#title'] = t('The better title just for this field on this node type.');
}
drupal_add_css(drupal_get_path('module', 'imagefield') .'/imagefield.css');
$element['#id'] .= '-upload'; // Link the label to the upload field.
return theme('form_element', $element, $element['#children']);
}
<?php
function panels_form_alter(&$form, $form_state, $form_id){
if ($form_id == 'soy_poderosa_photo_node_form' && arg(0) == 'node' && arg(1) > 0 ){
$form['buttons']['submit']['#value'] = t("Submit your photo");
}
}