This file contains 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 | |
/** | |
* Implements hook_css_alter(). | |
*/ | |
function mymodule_css_alter(&$css) { | |
uasort($css, 'drupal_sort_css_js'); | |
$i = 0; | |
foreach ($css as $name => $style) { | |
$css[$name]['weight'] = $i++; |
This file contains 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 | |
$vars['content']['title'] = array( | |
'#type' => 'html_tag', | |
'#tag' => 'h2', | |
'#value' => l(decode_entities($vars['title']), $base_url . $vars['node_url']), | |
'#attributes' => $vars['title_attributes_array'], | |
'#weight' => $vars['content']['field_company']['#weight'] + .1, | |
); | |
?> |
This file contains 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 | |
if ($vars['view_mode'] != 'teaser') { | |
$view_mode = str_replace('_', '-', $vars['view_mode']); | |
$vars['attributes_array']['class'][] = 'node-' . $view_mode; | |
} | |
?> |
This file contains 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 | |
drupal_add_js('(function($) {$(document).ready(function() { | |
$("body").click(function() { | |
alert("Hello World"); | |
}); | |
});}(jQuery));', 'inline'); | |
?> |
This file contains 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 | |
/** | |
* Render promo | |
*/ | |
function promo_preprocess_node(&$vars, $hook) { | |
$vars['custom_share_title'] = ''; | |
$vars['custom_promo'] =''; | |
$class = ''; | |
$style = ''; | |
$node = $vars['node']; |
This file contains 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
<span class="submitted"><?php print $submitted?></span> | |
<?php if ($submitted) { ?> | |
<span class="submitted"> | |
<?php | |
print 'by ' . theme('username', $node) . ' | ' . format_date($node->created, 'custom', 'd/m/Y'); | |
if ($terms) { | |
print ' | in '; | |
} | |
?> |
This file contains 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 | |
/* This code created an alphabetized index, when I combined them, I created a mess. | |
foreach ($build as $key => $value) { | |
$companies[$value['#markup'][0]][] = $value['#markup']; | |
} | |
*/ | |
asort($build); | |
foreach ($build as $key => $value) { | |
$markup = strtoupper($value['#markup'][0]); |
This file contains 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($) { | |
Drupal.behaviors.myBehavior = { | |
attach: function (context, settings) { | |
$("body").click(function() { | |
alert("Hello World"); | |
}); | |
} | |
}; | |
})(jQuery); |
This file contains 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
/** | |
* @implements hook_views_pre_view(). | |
* @param $view | |
* @param $display_id | |
* @param $args | |
* | |
* Programmatically set a Drupal view argument based on the field of the current user. | |
*/ | |
function tng_weekly_view_views_pre_view(&$view, &$display_id, &$args) { |
This file contains 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
* Implements hook_form_alter(). | |
* | |
* Modify quantity text | |
*/ | |
function HOOKNAME_form_alter(&$form, &$form_state, $form_id) { | |
if (strstr($form_id, 'commerce_cart_add_to_cart_form')) { | |
// Rename add-to-cart form fields label (quantity). | |
$form['quantity']['#title'] = t('Quantity'); | |
} |
OlderNewer