Skip to content

Instantly share code, notes, and snippets.

@driesd
driesd / custom_block_render.php
Created August 29, 2013 10:09
Render a specific block
<?php
//CUSTOM BLOCK RENDERING
function mytheme_block_render($module, $block_id) {
$block = block_load($module, $block_id);
$block_content = _block_render_blocks(array($block));
$build = _block_get_renderable_array($block_content);
$block_rendered = drupal_render($build);
print $block_rendered;
}
@driesd
driesd / block_cache_disable.php
Created August 29, 2013 10:08
Disable block cache for a specific block
<?php
//DISABLE BLOCK CACHE
function mytheme_block_info_alter(&$blocks, $theme, $code_blocks) {
$blocks['addtoany']['addtoany_button']['cache'] = DRUPAL_NO_CACHE;
}
@driesd
driesd / get_parameter_by_name.js
Created August 29, 2013 08:46
Gets any querystring parameter by name (with JavaScript)
//GETS ANY QUERYSTRING PARAMETER BY NAME
function getParameterByName(name) {
var match = RegExp('[?&]' + name + '=([^&]*)').exec(window.location.search);
return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
}