Skip to content

Instantly share code, notes, and snippets.

View heddn's full-sized avatar

Lucas Hedding heddn

View GitHub Profile
@heddn
heddn / myTheme.js
Last active December 23, 2015 09:09
(function ($) {
/**
* Register the myTheme behavior.
*/
Drupal.behaviors.myTheme = {
attach: function (context, settings) {
Drupal.myTheme.DatePicker(context, settings);
}
};
@heddn
heddn / ibs_services.module
Created October 1, 2013 18:53
disable commerce profile clone
/**
* Implements hook_entity_query_alter().
*/
function ibs_services_entity_query_alter($query) {
// Don't allow commerce to clone new custom profiles.
// Inspired by http://www.bywombats.com/blog/04-12-2013/bypassing-drupal-commerce-customer-profile-duplication.
if (isset($query->tags['commerce_order_commerce_customer_profile_can_delete'])) {
$query->propertyCondition('order_id', 1);
}
}
@heddn
heddn / example.module
Created October 3, 2013 16:52
example validate and submit handlers
$form['#validate'] = array(
'user_login_name_validate',
'rules_forms_event_validate',
'example_login_final_validate',
);
$form['#submit'][] = 'example_login_cart_convert';
<?php
// Hide totals field.
foreach (element_children($form['field_total_price']) as $key) {
$form['field_total_price'][$key]['#access'] = FALSE;
}
@heddn
heddn / example.module
Last active December 31, 2015 01:49
Entity Reference autocomplete FAPI example.
$form['product_line_item_ref'] = array(
'#type' => 'textfield',
'#title' => t('Product Line Item Reference'),
'#description' => t('Enter the product line item.'),
// The last 4 URL parameters are important.
// 4: Use <NULL> as a placeholder in the URL when we don't have an entity.
// 3: Bundle, in our case the specific type of commerce line item but for node, that could page, etc.
// 2: Entity type, commerce line item in our example but node is also a valid type.
// 1: Field name that is the entityreference field.
'#autocomplete_path' => 'entityreference/autocompelete/single/commerce_product_line_item_ref/commerce_line_item/related_lines/NULL',
<?php
/**
* @file
* HTML Migration.
*/
abstract class PfizerProMigration extends Migration {
public $baseDir;
public $siteMapArray;
/**
<?php
/**
* @file
* HTML Migration.
*/
abstract class PfizerProMigration extends Migration {
public $baseDir;
public $siteMapArray;
/**
/**
* Create a taxonomy term and return the tid.
*/
function asg_estimate_create_taxonomy_term($name, $vid) {
$term = new stdClass();
$term->name = $name;
$term->vid = $vid;
taxonomy_term_save($term);
return $term->tid;
}
/**
* Removes group_2 content.
*/
function pfizer_pro_tikosyn_education_update_7001() {
$query = db_select('url_alias', 'a')
->fields('a', array('source'))
->condition('alias', 'hcp/tikosyn_education%', 'LIKE');
$result = $query->execute()->fetchCol();
// The result set from url_alias includes 'node/123'. We need to remove node/.
node_delete_multiple(array_map(function ($value) { return substr($value, 5); }, $result));
31. Pushing /files to Acquia - only new or changed files, never deletes any file (as we might loose uploaded CMS content)
sending incremental file list
fixtures/tikosyn_education/lightbox/deering.html
fixtures/tikosyn_education/lightbox/diamond-chf.html
fixtures/tikosyn_education/lightbox/diamond-mi.html
fixtures/tikosyn_education/lightbox/dosing.html
fixtures/tikosyn_education/lightbox/efficacy.html
fixtures/tikosyn_education/lightbox/ellenbogen.html
fixtures/tikosyn_education/lightbox/moa.html