Skip to content

Instantly share code, notes, and snippets.

View DuaelFr's full-sized avatar

Edouard Cunibil DuaelFr

View GitHub Profile
@DuaelFr
DuaelFr / gist:1336384
Created November 3, 2011 12:32
Prestashop a11y lol
Sample found in blockuserinfo.tpl
<li id="shopping_cart">
{l s='Cart:' mod='blockuserinfo'}
<a href="{$link->getPageLink("$order_process.php", true)}" title="{l s='Your Shopping Cart' mod='blockuserinfo'}">
<span class="ajax_cart_quantity{if $cart_qties == 0} hidden{/if}">{$cart_qties}</span>
<span class="ajax_cart_product_txt{if $cart_qties != 1} hidden{/if}">{l s='product' mod='blockuserinfo'}</span>
<span class="ajax_cart_product_txt_s{if $cart_qties < 2} hidden{/if}">{l s='products' mod='blockuserinfo'}</span>
{if $cart_qties >= 0}
@DuaelFr
DuaelFr / gist:4664453
Created January 29, 2013 14:02
How to use Drupal messages within an ajax call.
<?php
/**
* Implements hook_menu().
*/
function MYMODULE_menu() {
$items = array();
$items['login'] = array(
'title' => t('Log in'),
@DuaelFr
DuaelFr / gist:4664660
Created January 29, 2013 14:32
hook_default_rules_configuration() advanced sample.
<?php
/**
* Implements hook_default_rules_configuration().
*/
function MYMODULE_default_rules_configuration() {
$rules = array();
// Custom rule : calculate the weight of a line item
$rule = rule($variables, $provides);
@DuaelFr
DuaelFr / feature_content_timelines.install
Created May 5, 2013 18:05
Waiting for Reply's Features integration
<?php
/**
* @file
* Code for the Feature Content Timelines feature.
*/
/**
* Implements hook_install().
*/
function feature_content_timelines_install() {
@DuaelFr
DuaelFr / .gitconfig
Last active February 1, 2023 23:34
Useful git config
[alias]
a = add
aa = add -A
ac = "!f() { curl $@ | git apply --index; }; f"
ac3 = "!f() { curl $@ | git apply -3 --index; }; f"
amend = commit --amend -C HEAD
ap = add -p
app = apply --index
br = branch
cb = checkout -b
@DuaelFr
DuaelFr / gist:5686084
Created May 31, 2013 16:16
Get webform submission data keyed by component's machine names instead of component's ids
<?php
/**
* Implements hook_mail_alter().
*
* Add the wanted attachment to submission email.
*
* @param Array $message
*/
function MODULE_mail_alter(&$message) {
/**
* View a tracking item.
*/
function ise_tracking_item_view($tracking_item) {
$semaphore = &drupal_static(__FUNCTION__, FALSE);
if (empty($semaphore)) {
$semaphore = TRUE;
return entity_view('tracking_item', array($tracking_item));
}
}
function entity_access($op, $entity_type, $entity = NULL, $account = NULL) {
if (($info = entity_get_info()) && isset($info[$entity_type]['access callback'])) {
return $info[$entity_type]['access callback']($op, $entity, $account, $entity_type);
}
}
<?php
/**
* Get all users of a group who contributed.
*/
function _events_resource_get_users_in_group($gid) {
$query = db_select('og_membership', 'ogm');
$query->join('node', 'n', "n.nid = ogm.etid AND ogm.entity_type = 'node'");
$query->join('user', 'u', 'n.uid = u.uid');
$query->fields('n', array('uid'))
'settings' => array(
'handler' => 'og',
'handler_settings' => array(
'behaviors' => array(
'og_behavior' => array(
'status' => TRUE,
),
'views-select-list' => array(
'status' => 1,
),