Skip to content

Instantly share code, notes, and snippets.

@shushu
shushu / gist:95494392c43faaa250d0
Created June 9, 2014 08:32
behat print to file
/**
* @Then /^I should print page to "([^"]*)"$/
*/
public function iShouldPrintPageTo($file) {
$element = $this->getSession()->getPage();
file_put_contents($file, $element->getContent());
}
@shushu
shushu / hook_field_attach_create_bundle.php
Last active August 29, 2015 14:01
hook_field_attach_create_bundle
<?php
/**
* Implements hook_field_attach_create_bundle().
*
* When creating a new vocabulary attach the right fields.
*/
function my_module_field_attach_create_bundle($entity_type, $bundle) {
if ($entity_type != 'taxonomy_term') {
return;
}
@shushu
shushu / hook_og_fields_info.php
Last active August 29, 2015 14:01
Example for hook_og_fields_info() implementation.
<?php
/**
* Implements hook_og_fields_info().
*/
function my_module_og_fields_info() {
// Note: from the features export the item name is "field_my_field", but we
// better not keep the "field_" prefix.
$items['my_field'] = array(
// Type of the new OG field. 'group content' since we want to add it to
@shushu
shushu / ddsdd
Created December 25, 2013 13:42
<html>
<head>
<title>Sample "Hello, World" Application</title>
</head>
<body bgcolor=white>
<table border="0" cellpadding="10">
<tr>
<td>
<img src="images/springsource.png">
@shushu
shushu / rules_clone_subscription_order
Created April 9, 2013 21:27
Clone subscription order
{ "rules_clone_subscription_order" : {
"LABEL" : "Clone subscription order",
"PLUGIN" : "reaction rule",
"REQUIRES" : [ "rules", "commerce_paypal_ipn_rules_integration", "commerce_checkout" ],
"ON" : [ "commerce_paypal_ipn_rules_integration_ipn_process" ],
"IF" : [
{ "data_is" : { "data" : [ "order:status" ], "value" : "completed" } },
{ "data_is" : {
"data" : [ "txn-type" ],
"op" : "IN",
@shushu
shushu / rules_notify_amdin_on_ipn_cancellation_message
Created April 9, 2013 20:38
Notify amdin on IPN cancellation message
{ "rules_notify_amdin_on_ipn_cancellation_message" : {
"LABEL" : "Notify amdin on IPN cancellation message",
"PLUGIN" : "reaction rule",
"REQUIRES" : [ "rules", "commerce_paypal_ipn_rules_integration" ],
"ON" : [ "commerce_paypal_ipn_rules_integration_ipn_process" ],
"IF" : [
{ "data_is" : {
"data" : [ "txn-type" ],
"op" : "IN",
"value" : { "value" : [
@shushu
shushu / rules_set_subscription_while_checkout_via_paypal
Created April 9, 2013 19:38
Simple rule that set subscription to a Paypal order
{ "rules_set_subscription_while_checkout_via_paypal" : {
"LABEL" : "Set subscription while checkout via paypal",
"PLUGIN" : "reaction rule",
"REQUIRES" : [ "rules", "commerce_paypal_ipn_rules_integration" ],
"ON" : [ "commerce_paypal_ipn_rules_integration_paypal_wps_redirect" ],
"IF" : [
{ "entity_has_field" : {
"entity" : [ "order:commerce-line-items:0" ],
"field" : "commerce_product"
}