Skip to content

Instantly share code, notes, and snippets.

View nrackleff's full-sized avatar

Nancy Rackleff nrackleff

View GitHub Profile
Steps to update local dev environment to PHP5.6 to be ready for Drupal 8.
In a terminal window:
brew update ( you may also may need to run brew doctor if you get an error on brew update)
brew unlink php55
brew install php56 --with-homebrew-apxs --with-apache
brew install php56-xdebug
$(document).ready(function() {
// Default to US on page load
if ($("#edit-line-item-fields-field-delivery-options-und").val() != 'Hold Dedication for pickup at TreePeople office') {
$("select.country.form-control.form-select").val('US').change();
}
else {
$("#edit-line-item-fields-field-recipient-address").hide();
}
$("#edit-line-item-fields-field-delivery-options-und").change(function(){
<?php
// Inside form alter function insert validation using buttons like commerce does.
// Insert the validation at the beginning of the array so the commerce module
// can access any of our errors and place them in the correct block instead of at top of page.
array_unshift($form['buttons']['continue']['#validate'], 'treepeople_commerce2_organization_validate');
// Inside the validate function, set the errors using a special concatenated field name
// that include the panel the field is in. Notice there are no outer brackets.
form_set_error('customer_profile_billing][field_organization_name', t('Company/Organization Name field is required.'));
@nrackleff
nrackleff / Create a Drupal Module Release.md
Last active February 23, 2016 00:32 — forked from Greg-Boggs/Create a Drupal Module Release.md
How to Create a new Drupal Module Release for a ThinkShout maintained module.
  • git checkout 7.x-1.x
  • git tag 7.x-1.0
  • git push origin tag 7.x-1.0
  • Click the Version control tab on your project page, and follow the instructions labeled Tag for a stable release.
  • Return to the main project page, and then click the Add new release link at the bottom of the page.
  • Select your tag, such as 7.x-1.0, and save the form.
  • Select the terms that correspond to the nature of the release (Features, Bug fixes), and fill out release notes.
  • When creating a D7 release you will need to be using Drush 7. Install with the following composer command: composer global require drush/drush:7.1.0
  • drush dl grn
  • Use drush grn to generate release notes (drush release-notes)
<?php
/**
* Implements hook_user_view_alter().
*/
function mymodule_user_view_alter(&$build) {
// Insert the contact link into the body of the display page.
if ($build['#account']->data['contact']) {
$link_text = $build['#account']->field_first_name['und'][0]['safe_value'] ? "email " . $build['#account']->field_first_name['und'][0]['safe_value'] : "email";
$contact_link = l($link_text,'user/' . $build['#account']->uid . '/contact');
$build['contact_link'][0]['#markup'] = "<div class=\"field\"><div class=\"field-label\">" . t('Contact') . ":&nbsp;</div><div class=\"field-items\"><div class=\"field-item even\">" . $contact_link . "</div></div></div>";