Skip to content

Instantly share code, notes, and snippets.

@driesd
driesd / new_gist_file_0
Created April 21, 2014 15:13
Adding node type and node id to the link field in WYSIWYG.
//----------------------------------------
//------------- CKEDITOR -----------------
//----------------------------------------
/*
* alter cklink to add language
*/
function YOUR_MODULE_ckeditor_link_autocomplete_alter(&$results, &$string){
if ($string !== '') {
$types = ckeditor_link_get_types();
$results = array();
@driesd
driesd / google_map_custom_icon.html
Created April 21, 2014 15:13
Google map with custom icon + custom balloon Google Maps Custom markers info: https://developers.google.com/maps/tutorials/customizing/custom-markers Google MAPS API: https://developers.google.com/maps/documentation/javascript/reference#InfoWindow -------> ATTENTION: do not put this code in de document load part <---------------
// add this to your html page (e.g. in a block)
<div id="map_canvas">map_canvas</div>
@driesd
driesd / only_variables_passed_by_reference_1679118_4.patch
Created April 21, 2014 15:13
Video embed field module 7.x-2.0-beta5 - Strict warning: 'Only variables should be passed by reference in template_preprocess' Bron: https://drupal.org/node/1679118
diff --git a/video_embed_field.module b/video_embed_field.module
index 54491d4..8a45ebb 100755
--- a/video_embed_field.module
+++ b/video_embed_field.module
@@ -354,7 +354,8 @@ function template_preprocess_video_embed_field_embed_code(&$variables) {
// Prepare embed code
if ($handler && isset($handler['function']) && function_exists($handler['function'])) {
- $variables['embed_code'] = drupal_render(call_user_func($handler['function'], $variables['url'], $variables['style_settings']));
+ $embed_code = call_user_func($handler['function'], $variables['url'], $variables['style_settings']);
@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'];
@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 / 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 / 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 / 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 / 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 / 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,