This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Drupal.behaviors.FlexsliderEvents = { | |
attach: function (context, settings) { | |
for (var slider in settings.flexslider.instances) { | |
if(settings.flexslider.instances[slider] == "upcoming_events") { | |
$('.view-calendar .flexslider', context).bind('init', function(e, slider) { | |
var numItems = getGridSize(); | |
slider.vars.minItems = numItems; | |
slider.vars.maxItems = numItems; | |
$(window).smartresize(function() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Add wrapper to inline form element | |
function main_preprocess_form_element(&$variables) { | |
if(isset($variables['element']['#type']) && $variables['element']['#type'] == "item" && isset($variables['element']['#markup'])) { | |
$variables['element']['#markup'] = '<div class="inline-item">' . $variables['element']['#markup'] . '</div>'; | |
$variables['element']['#children'] = '<div class="inline-item">' . $variables['element']['#markup'] . '</div>'; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function rangerettes_commerce_form_alter(&$form, $form_state, $form_id) { | |
// Cart Form | |
if (strpos($form_id, 'views_form_commerce_cart_form_default') === 0) { | |
foreach($form['edit_quantity'] as $id => $quanity_item) { | |
if(is_array($quanity_item)) { | |
$line_item = commerce_line_item_load($quanity_item['#line_item_id']); | |
if($line_item->type == "camp_registration") | |
unset($form['edit_quantity'][$id]); // Remove quantity form for Camp Registrations | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$query = new EntityFieldQuery(); | |
$query->entityCondition('entity_type', 'node') | |
->entityCondition('bundle', 'newsletters') | |
->propertyCondition('status', 1) | |
->propertyOrderBy('created', 'DESC') | |
->range(0, 1); | |
$result = $query->execute(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function path_redirect_newest_menu() { | |
$items['media/gallery'] = array( | |
'page callback' => 'path_redirect_newest_gallery', | |
'access callback' => TRUE, | |
); | |
return $items; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@function em($px, $context-or-rem: strip_unit($base-font-size)) { | |
@if($context-or-rem == true) { | |
@return $px / strip_unit($base-font-size) * 1rem; | |
} @else { | |
@return $px / $context-or-rem * 1em; | |
} | |
} | |
/// Remove the unit of a length | |
/// @param {Number} $number - Number to remove unit from |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$mysqli = new mysqli("example.com", "user", "password", "database"); | |
if ($mysqli->connect_errno) { | |
echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error; | |
} | |
// Bind Parameters | |
$params = array(); | |
// Bind Parameter Types: s = string, i = integer, d = double, b = blob |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function encore_project_images_url_inbound_alter(&$path, $original_path, $path_language) { | |
// Grab URL arguments | |
$path_arguments = explode('/', $path); | |
// Check if 3 arguments are there | |
if(count($path_arguments) == 3) { | |
// Create node path out of the first two arguments to see if it's a node | |
$node_alias = $path_arguments[0] . "/" . $path_arguments[1]; |