Skip to content

Instantly share code, notes, and snippets.

Rob Decker robdecker

Block or report user

Report or block robdecker

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@robdecker
robdecker / template.php
Last active Nov 2, 2019
[Put the path to the theme in Drupal.settings for use in javascript files] #d7
View template.php
<?php
function mytheme_preprocess_page(&$vars) {
// Add the path to this theme to Drupal.settings
$setting['pathToTheme'] = path_to_theme();
drupal_add_js($setting, 'setting');
}
// OR:
@robdecker
robdecker / template.php
Last active Nov 2, 2019
[Add active contexts to body classes] Insert into THEME_preprocess_page() #d6
View template.php
// List active contexts from "context" module.
$contexts = context_active_contexts();
foreach ($contexts as $context) {
$vars['body_classes'] .= ' context_' . $context->name;
}
@robdecker
robdecker / clear-drupal-cache.php
Last active Nov 2, 2019 — forked from samsargent/clear-drupal-cache.php
[Clear all caches from a php file] #d6
View clear-drupal-cache.php
<?php
include_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
drupal_flush_all_caches();
?>
@robdecker
robdecker / style.css
Last active Nov 2, 2019
[Clearfix. IE6+] #css
View style.css
.group:before,
.group:after {
content: "";
display: table;
}
.group:after {
clear: both;
}
.group {
zoom: 1; /* For IE 6/7 (trigger hasLayout) */
@robdecker
robdecker / style.css
Last active Nov 2, 2019
[Clearfix. IE8+] #css
View style.css
.group:after {
content: "";
display: table;
clear: both;
}
@robdecker
robdecker / node.tpl.php
Last active Nov 2, 2019
[Theme ImageCache image] #d6
View node.tpl.php
$image = theme('imagecache', 'imagecache-preset', $node->field_main_image[0]['filepath']);
@robdecker
robdecker / node.tpl.php
Last active Nov 2, 2019
[Theme an image (basic info only)] #d7
View node.tpl.php
print theme('image_style', array( 'path' => $field[0]['uri'], 'style_name' => 'gallery_thumbnail'));
@robdecker
robdecker / node.tpl.php
Last active Nov 2, 2019
[Theme an image (with html attributes)] #d7
View node.tpl.php
print theme('image_style', array( 'path' => $images[$i]['uri'], 'style_name' => 'photo-slideshow', 'attributes' => array('class' => 'img'.$i)));
@robdecker
robdecker / template.php
Last active Nov 2, 2019
[Snippet for theme_breadcrumb] #d7
View template.php
/**
* Implements theme_breadcrumb().
*/
function THEME_breadcrumb(&$vars) {
$breadcrumb = $vars['breadcrumb'];
if (!empty($breadcrumb)) {
$output = '<h2 class="element-invisible">' . t('You are here') . '</h2>';
$breadcrumb_separator = '<span class="separator"> &raquo; </span>';
$output .= '<div class="breadcrumb">' . implode($breadcrumb_separator, $breadcrumb) . '</div>';
return $output;
@robdecker
robdecker / module.info
Last active Nov 2, 2019
[Module.info stub] #d7
View module.info
name =
description = ""
package = Other
core = 7.x
configure = admin/config/path/to/config
dependencies[] =
files[] =
You can’t perform that action at this time.