Skip to content

Instantly share code, notes, and snippets.

function THEMENAME_js_alter(&$javascript) {
$javascript['misc/jquery.js']['data'] = drupal_get_path('theme', 'THEMENAME') .
'/javascripts/jquery-1.7.2.min.js';
$javascript['misc/jquery.js']['version'] = '1.7.2';
}
@tmsss
tmsss / ctools modal handlers
Created November 12, 2013 21:54
Binding ctools modal handlers dynamically without page reload from http://www.nextide.ca/node/672
$('area.ctools-use-modal, a.ctools-use-modal').each( function() {
var $this = $(this);
$this.unbind(); // Note the unbind: Otherwise there are multiple bind events which causes issues
$this.click(Drupal.CTools.Modal.clickAjaxLink);
// Create a drupal ajax object
var element_settings = {};
if ($this.attr('href')) {
element_settings.url = $this.attr('href');
element_settings.event = 'click';
element_settings.progress = {
@tmsss
tmsss / Drupal 6 jQuery behaviors
Created November 14, 2013 10:51
Drupal 6 jQuery behaviors (toggle example)
Drupal.behaviors.toggle = function(context) {
/*Add your js code here*/
$('#day').hide();
$("#show-example").click(function () {
if ($('#day').is(":visible")) {
$(this).html($(this).html().replace(/Hide/, 'Show'));
} else {
$(this).html($(this).html().replace(/Show/, 'Hide'));
}
@tmsss
tmsss / Using Drush to update to a specific version of core (not just the latest)
Last active November 4, 2015 18:14
Using Drush to update to a specific version of core (not just the latest)
drush pm-update projects drupal-6.28
from https://www.drupal.org/node/1861436>
function MYTHEME_form_alter(&$form, &$form_state, $form_id) {
if ($form_id == 'search_block_form') {
$form['actions']['button']['#prefix'] = '<button type="submit">';
$form['actions']['button']['#suffix'] = '</button>';
$form['actions']['button']['#markup'] = '<i class="icon-search"></i>';
}
}
<?php
$menu = menu_navigation_links('menu-your-custom-menu-name');
print theme('links__menu_your_custom_menu_name', array('links' => $menu));
?>
@tmsss
tmsss / box-sizing-prefixes.css
Last active November 25, 2015 22:32
Circular div with fontawesome icon inside
html {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
@tmsss
tmsss / drop_caps.css
Created November 27, 2015 10:26
Drop caps
p:first-letter{
display:block;
margin:5px 0 0 5px;
float:left;
color:#FF3366;
font-size:60px;
font-family:Georgia;
}
@tmsss
tmsss / delete node revisions.mysql
Created January 26, 2016 16:04
Delete node revisions from database
DELETE FROM `node_revisions` WHERE node_revisions.vid NOT IN (SELECT node.vid FROM `node` );
@tmsss
tmsss / page.tpl.php
Created February 6, 2016 16:48
Print a views block
<?php echo views_embed_view('view-machine-name', $display_id = 'view-id'); ?>