Skip to content

Instantly share code, notes, and snippets.

@keeprock
keeprock / custom.module.php
Created March 6, 2015 08:41
Viewing Voodoo Helper variables inside a template or custom code
voodoo_helper_get_field_by_varname('VAR_NAME');
@keeprock
keeprock / template.php
Created March 6, 2015 09:02
Path to theme
base_path() . path_to_theme()
@keeprock
keeprock / template.php
Created March 6, 2015 11:57
Add markup before or after the title
function custom_preprocess_page(&$vars) {
$vars['title_prefix'][] = array(
'#markup' => 'HTML_MARKUP_HERE'
);
$vars['title_suffix'][] = array(
'#markup' => 'HTML_MARKUP_HERE'
);
@keeprock
keeprock / new_gist_file_0
Created March 10, 2015 06:30
Import mysql using SSH
mysql -u username -pPassword --host hostname database_name < dump.sql
@keeprock
keeprock / index.html
Created March 10, 2015 07:39
Justify text with UL and LI elements using "text-align: justify" property http://www.barrelny.com/blog/text-align-justify-and-rwd/
<ul id="Grid">
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
@keeprock
keeprock / style.css
Created March 10, 2015 13:53
Center absolute positioned div
#content{
position:absolute;
left:0;
right:0;
margin-left:auto;
margin-right:auto;
}
@keeprock
keeprock / custom.module.php
Last active August 29, 2015 14:16
Loading a form using Ctools AJAX API
function custom_menu() {
$items['custom_module/some_title_describing_action/%ctools_js'] = array(
'title' => 'Subscribe',
'page callback' => 'custom_form__callback',
'page arguments' => array(2), // index starts with zero
'type' => MENU_CALLBACK,
'access callback' => TRUE
);
return $items;
#selector {
max-height: 0;
transition: max-height 0.15s ease-out;
overflow: hidden;
}
#selector.active {
max-height: 500px;
transition: max-height 0.25s ease-in;
}
@keeprock
keeprock / custom.module.php
Last active August 29, 2015 14:16
Create a new style for a modal Ctools window. Allows to customize a size of the window.
function custom_init() {
//Customize modal window
drupal_add_js(array(
'CUSTOM_MODAL' => array(
'modalSize' => array(
'type' => 'fixed',
'width' => 850,
'height' => 550,
),
//Animation mode
function getQueryVariable(variable)
{
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
if(pair[0] == variable){return pair[1];}
}
return(false);
}