Outside Links collection sticky icon

Sometimes you find just the right resources that fulfill certain need and nothing much should be added to them, in those cases I will just collect them on this page and add short comment why is this so.

How to combine Git and Drush to have perfect workflow for site maintenance, information and examples are here

Setting upt perfect Git + Drush workflow, read here

Add title/label to fivestar field in custom form

Took time to find out this one. To set title or label for a fivestar form field you need to add
'#title' => t('Your rate'), to your code, so it should go like.

$pane_form['rating'] = array(
'#type' => 'fivestar',
'#default_value' => 100,
'#title' => t('Your rate'),
'#widget' => array(
'name' => 'some__stars',

Wondering how to combine drupal with mailchimp content wise - use RSS

Use Mailchimp's RSS-Driven Campaign as it is refered to here. So make a view outputting RSS and use that.


Preprocess bean template, add template suggestions like view_mode

You can preprocess nodes and fields with hook_preprocess_field hook_preprocess_node, but when it comes to beans, you need to use different approach, hook_preprocess_bean doesn't exists. So to do this, you need to use this

function my_theme_process_entity(&$vars) {view_mode
if ($vars['entity_type'] == 'bean') {
if ($vars['bean']->type == 'YOUR_BEAN_TYPE') {
$vars['theme_hook_suggestions'][] = 'bean__' . $vars['bean']->type . '__' . $vars['#view_mode'];

Contextual filter(views) for date ranges

I was building a view for RestWS to output JSONon data, to have date show for specific date range you need to pass filter range. To do that you need to pass filter as two dates, with separator beeing "--" e.x. 2015-06-24--2015-06-28

Or in full link it would be


Add to cart form, change output - separating attributes from buy button

This one was not easy. Changing product display, which is node is possible in different ways, but then you have a field_product_reference, which outputs buy button and attributes buttons. So you moved around price in your node template, body/description etc, but you want to separate attributes changing widget and buy. You just can't. Even if you change data in template, as it is using Ajax to refresh on clicking of any attributes. So you will lose your changes, made in template, or any other place you maybe found.

Choosing which PHP to run with Drush, changing CLI php

Using drush on mac with mamp gave me some problems with default setup. I didnt set
DRUSH_PHP variable anywhere so default php was used, also with that no php.ini setting was set and in my drush status I got empty "Drush configuration" variable. So to set this up, I needed to add this to either .profile or to .bash_profile (depends of load order, later goes first if you have it)

export DRUSH_PHP=/Applications/MAMP/bin/php/php5.3.29/bin/php

Changing Product attributes in drupal commerce, maintain data with ajax reload

What I needed is to preprocess this whole group of data, that consist add to cart button and attributes fields. "Add to cart form" is basically the one that consists attributes and add to cart button. To do that the only way to make it work with AJAX is with form alter. So change the forms data in

function my_module_form_commerce_cart_add_to_cart_form_alter(&$form, &$form_state) {

and you can probably get what you need. Think this is the only way. Templates get overrun by Ajax calls and only work on first generating of product.

Get address lat and long with google api

This will give you a nice array of all the data.

$request = drupal_http_request('https://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA');
$out = drupal_json_decode($request->data);

Change Views filters, add dynamic date value as range

Using EVA field added to Order entity I needed to use order created date as starting range and ending range for dates.
UI by default doesn't offer this in views, so some preprocessing was done. You could fetch date from argument or as I did directly from
$view->current_entity->created; and add it to filter as you like. Use views_pre_build, add code, Clear Cache and it will work.

function mymodule_views_pre_build(&$view) {

//Override output of Filter

if($view->name == 'commerce_user_orders' && $view->current_display == 'entity_view_6'){

//Set Times