Skip to content

Instantly share code, notes, and snippets.

View ipwa's full-sized avatar

Nicolas Borda ipwa

  • Manifesto
  • London, UK
View GitHub Profile
@ipwa
ipwa / gist:77274272e3df05d09469
Created April 10, 2015 16:32
Email Contact hook_menu
/**
* Implements hook_menu().
*/
function email_contact_menu() {
$items['email-contact/%/%/%'] = array(
'title' => 'Email Contact Form',
'page callback' => 'email_contact_mail_page',
'page arguments' => array(1, 2, 3),
'access callback' => 'user_access',
'access arguments' => array('access content'),
@ipwa
ipwa / 0_reuse_code.js
Created March 20, 2016 00:56
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@ipwa
ipwa / gist:61112c6cc272915fa71bb44aa4009e66
Last active November 13, 2017 08:54
Use different menus for different languages in Drupal 7 template
<?php
global $language;
$main_menu = menu_tree_output(menu_tree_all_data('main-menu', NULL, 2));
$menu_principal = menu_tree_output(menu_tree_all_data('menu-menu-principal-espanol', NULL, 2));
?>
<?php if ($language->language == 'en'): ?>
<?php print drupal_render($main_menu); ?>
<?php elseif ($language->language == 'es'): ?>
<?php print drupal_render($menu_principal); ?>
@ipwa
ipwa / gist:7c1dc0041c9a88d91a2279a337413327
Last active November 13, 2017 08:54
Rule to make roomify booking charge for only one day of booking
{ "rules_chicama_pay_one_day" : {
"LABEL" : "Chicama pay one day",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules", "commerce_product_reference" ],
"ON" : { "commerce_product_calculate_sell_price" : [] },
"IF" : [
{ "entity_has_field" : { "entity" : [ "commerce-line-item" ], "field" : "commerce_product" } }
],
"DO" : [