Skip to content

Instantly share code, notes, and snippets.

View bangpound's full-sized avatar

Benjamin Doherty bangpound

View GitHub Profile
@bangpound
bangpound / gist:6117282
Created July 30, 2013 21:43
Render Drupal fields inside the rendered markup of other Drupal fields.
<?php
/**
* Implement hook_file_view_alter().
*
* @param type $build
* @param type $entity_type
*/
function MODULE_file_view_alter(&$build, $entity_type) {
$qp = QueryPath::withHTML($build['field_caption']['0']['#markup']);
@bangpound
bangpound / gist:6117279
Created July 30, 2013 21:43
Render Drupal fields inside the rendered markup of other Drupal fields.
<?php
/**
* Implement hook_file_view_alter().
*
* @param type $build
* @param type $entity_type
*/
function MODULE_file_view_alter(&$build, $entity_type) {
$qp = QueryPath::withHTML($build['field_caption']['0']['#markup']);
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bangpound
bangpound / gist:5799683
Last active December 18, 2015 14:49
use secure token in action emal.
<?php
/**
* Implements hook_action_info().
*/
function MODULE_action_info() {
return array(
'MODULE_send_email_secure_tokens_action' => array(
'type' => 'system',
'label' => t('Send e-mail with user secure tokens'),
{
"created_at": "Tue Jun 04 13:33:08 +0000 2013",
"id": "341910491351904258",
"id_str": "341910491351904258",
"text": "Ben Bir Ceviz agaciyim GEZİ PARKİNDAYİM. #direngeziparkı http://t.co/eI2Ae4BSO7",
"source": "<a href=\"http://twitter.com/download/iphone\" rel=\"nofollow\">Twitter for iPhone</a>",
"truncated": false,
"in_reply_to_status_id": null,
"in_reply_to_status_id_str": null,
"in_reply_to_user_id": null,
@bangpound
bangpound / gist:4744600
Created February 9, 2013 08:35
Written for oEmbed module (but not committed), this snippet extracts script elements from the html property of oEmbed responses that are "video" or "rich." The scripts are added to a the render array as #attached. This also suggests a way to create produce opengraph meta tags from oEmbed media by using #attached['html_head']
<?php
$embed = $element['#embed'];
// Check if the oEmbed response provides a thumbnail image.
if (empty($embed['html'])) {
$element['#printed'] = TRUE;
return $element;
}
<?php
/**
* Implements hook_block_info().
*/
function eifundraising_block_info() {
$blocks = array();
$blocks['thermometer'] = array(
'info' => t('Thermometer'),
'description' => t('Thermometer'),
diff --git a/status.php b/status.php
new file mode 100644
index 0000000..ab415ed
--- /dev/null
+++ b/status.php
@@ -0,0 +1,98 @@
+<?php
+// Register our shutdown function so that no other shutdown functions run before this one.
+// This shutdown function calls exit(), immediately short-circuiting any other shutdown functions,
+// such as those registered by the devel.module for statistics.
@bangpound
bangpound / embedded-jplayer.patch
Created October 21, 2012 01:45
support jplayer embedded in filtered text fields.
diff --git a/includes/jplayer.theme.inc b/includes/jplayer.theme.inc
index 410d605..3e63c96 100644
--- a/includes/jplayer.theme.inc
+++ b/includes/jplayer.theme.inc
@@ -15,8 +15,12 @@ function template_preprocess_jplayer(&$vars) {
$vars['mode'] = $vars['settings']['mode'];
// Get the field info so we can figure out what type it is.
- $field_info = field_info_field($vars['field_name']);
- $player = jplayer_sort_files($vars['items'], $vars['player_id'], $vars['mode'], $field_info['type']);