Skip to content

Instantly share code, notes, and snippets.

@rubedell
rubedell / webform_copy-node-title
Created August 29, 2013 08:15
Webform block - copy node title to hidden field
function the_aim_custom_form_alter(&$form, &$form_state, $form_id) {
switch ($form_id) {
//apply for job form
case 'webform_client_form_38':
//get title of current node and insert into webform field
$current_object = menu_get_object();
if(isset($current_object->title)) {
$job_title = $current_object->title;
$form['submitted']['vacature']['#default_value'] = $job_title;
}
@rubedell
rubedell / content_overview.info
Created August 29, 2013 08:46
Content overview without views (nodes - terms)
name = the AIM custom
package = the AIM
core = 7.x
@rubedell
rubedell / taxonomy-view-filter-fix.php
Created September 4, 2013 10:37
Taxonomy views - language filter fix
/**
* Implements hook_views_query_alter
* FIX TAXONOMY
* Add language filter to views
*/
function the_aim_custom_views_query_alter(&$view, &$query) {
if ($view->name == 'homepage_taxonomy_spotlight') {
$query->where[] = array(
'conditions' => array(array(
'field' => 'taxonomy_term_data.language',
@rubedell
rubedell / triangles.css
Created October 7, 2013 08:23
CSS3 triangles
.arrow-up {
width: 0;
height: 0;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-bottom: 5px solid black;
}
.arrow-down {
function equalHeight(element) {
var currentTallest = 0,
currentRowStart = 0,
rowDivs = new Array(),
$el,
topPosition = 0;
$(element).each(function() {
$el = $(this);
@rubedell
rubedell / combine-tax-main-menu.php
Created October 21, 2013 13:19
Combine taxonomy menu + main menu
/**
* Implements template_preprocess_taxonomy_menu_block()
* Adds the main-menu items to this taxonomy menu block
*/
function the_aim_theme_commerce_preprocess_taxonomy_menu_block(&$variables){
//only for block with delta == 1
if ( 1 == $variables['config']['delta']) {
if(isset($variables['items'][-1])) {
$links = menu_tree('main-menu');
foreach ($links as $link) {
@rubedell
rubedell / euro_symbol.php
Created October 25, 2013 12:03
Move the euro symbol before the price
/**
* Implements hook_commerce_currency_info_alter().
* Euro symbol beefore price
*/
function the_aim_custom_commerce_currency_info_alter(&$currencies, $langcode) {
$currencies['EUR']['symbol'] = '€ ';
$currencies['EUR']['symbol_placement'] = 'before';
$currencies['EUR']['code_placement'] = '';
}
@rubedell
rubedell / latest_product.php
Created October 28, 2013 10:45
Latest product (withouth views)
<?php
/**
* Implements hook_block_info().
*/
function the_aim_custom_block_info() {
$blocks['latest_product'] = array(
'info' => t('Latest product'),
);
return $blocks;
}