Skip to content

Instantly share code, notes, and snippets.

@driesd
driesd / form_novalidate.js
Created September 19, 2013 12:45
Disables client-side validation on forms
$('form').attr('novalidate', true);
@driesd
driesd / theme_file_link.php
Created September 30, 2013 10:54
Adds file size to a file field
@driesd
driesd / custom_block_back_to_overview.php
Created October 7, 2013 07:38
Provides a custom 'Back to overview' button - Block
<?php
/**
* Implementation of hook_block_info().
*/
function custom_block_back_to_overview_block_info() {
$blocks = array();
$blocks['back-to-overview'] = array(
'info' => t('CB - Back to overview'),
@driesd
driesd / customize_user_form.php
Created October 8, 2013 09:51
Customize the Drupal user forms (login & register)
<?php
/**
* Implements hook_user_login
*/
function MODULE_form_user_login_alter(&$form, &$form_state) {
$form['already_customer'] = array(
'#type' => 'markup',
'#markup' => '<h3>' . t('I am already a customer') . '</h3>',
'#weight' => -10,
@driesd
driesd / set_title_active_menu_trail.js
Created October 15, 2013 07:46
Sets the menu title to the active trail
$('.toggle h3').each(function() {
$(this).text($(this).next().find('li.active-trail').find('a').text());
if($(this).text() === "") {
$(this).html('Menu');
}
});
@driesd
driesd / mobile_toggle_icons.html
Created October 15, 2013 08:29
Provides toggle icons for mobile usability
<div id="mobile-icons">
<span class="mobile-icon mobile-icon-search">Search</span>
<span class="mobile-icon mobile-icon-menu">Menu</span>
</div>
@driesd
driesd / mobile_phone_numbers.scss
Created October 16, 2013 08:27
Themes phone numbers a[href^=tel] only for mobile
@include at-breakpoint($break-2) {
a[href^=tel] {
color: grey !important;
cursor: text;
text-decoration: none !important;
&:hover {
text-decoration: none !important;
}
}
}
@driesd
driesd / bulk_author_change.php
Last active December 26, 2015 12:59
Node operation to change the content author to siteowner
<?php
/**
* Implementation of hook_help().
*/
function bulk_author_change_help($path, $arg) {
switch ($path) {
case 'admin/help#bulk_author_change':
$output = '<h3>' . t('Add extra bulk operation for content') . '</h3>';
$output .= '<p>Unpublished node created by admin are not accessable for siteowners.<br />Therefore we must change the author of the nodes to siteowner. This module adds the extra bulk update action...</p>';
@driesd
driesd / jquery.aim.equalheights.js
Created December 13, 2013 10:39
Make elements equal height
(function($){
$.fn.equalheights = function(options, settings){
var max = 0,
that = this,
deBouncer = function($,cf,of, interval){
var debounce = function (func, threshold, execAsap) {
var timeout;
return function debounced () {
var obj = this, args = arguments;
@driesd
driesd / template.php
Created January 15, 2014 08:54
Provides rel="nofollow" on specific menu links
<?php
/**
* Implements theme_preprocess_menu_link()
*/
function the_aim_theme_preprocess_menu_link(&$variables) {
$nofollowlinks = array(367);
$element = &$variables['element'];