Skip to content

Instantly share code, notes, and snippets.

@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 / theme_file_link.php
Created September 30, 2013 10:54
Adds file size to a file field
@driesd
driesd / form_novalidate.js
Created September 19, 2013 12:45
Disables client-side validation on forms
$('form').attr('novalidate', true);
@driesd
driesd / select_input_text_on_click.js
Created September 19, 2013 12:43
Select the input field text on click
$('body').delegate('input', 'click', function () {
$(this).select();
});
@driesd
driesd / custom_termview_langfix.info
Created September 17, 2013 10:31
Adds the language filter condition to taxonomy term views
name = The AIM - Views term language
description = Fix / Add the language filter to taxonomy term views
core = 7.x
package = "Custom"
dependencies[] = "views"
dependencies[] = "views_ui"
dependencies[] = "i18n_taxonomy"
@driesd
driesd / commerce_euro.info
Created September 17, 2013 06:36
Commerce: Places the EURO symbol in front of the price value
name = "Commerce - EURO symbol fix"
description = "Places the EURO symbol in front of the price value"
core=7.x
package = "Commerce"
files[] = commerce_euro.module
@driesd
driesd / custom_tax_remove_desc.module
Created September 5, 2013 07:27
Taxonomy: Remove the description field
function custom_tax_remove_desc_form_taxonomy_form_term_alter(&$form, &$form_state, $form_id) {
$form['description']['#access'] = FALSE;
}
@driesd
driesd / custom_tokens.info
Created September 3, 2013 07:36
Provides a custom token in Drupal
name = "Custom tokens"
description = "Custom module to provide custom tokens"
package = "Custom"
core = 7.x
@driesd
driesd / file_format_file_size.php
Created August 29, 2013 13:16
Formats a file size (Bytes) into something readable (KB, MB, ...)
<?php
function __format_file_fize_size( $size, $display_bytes=false ) {
if( $size < 1024 )
$filesize = $size . ' bytes';
elseif( $size >= 1024 && $size < 1048576 )
$filesize = round( $size/1024, 2 ) . ' KB';
elseif( $size >= 1048576 )
$filesize = round( $size/1048576, 2 ) . ' MB';
@driesd
driesd / process_field.php
Created August 29, 2013 12:16
Processing fields
<?php
//NEEDED TO MAKE FIELD PROCESSING POSSIBLE PER FIELD
function mytheme_process_field(&$variables) {
$function = 'mytheme_process_field__'. $variables['element']['#field_name'];
if(function_exists($function)) {
$variables = $function($variables);
}
}