Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* Implements hook_preprocess_entity().
*/
function module_name_profile_preprocess_entity(&$vars) {
switch ($vars['entity_type']) {
case 'profile2':
// Use different template
$vars['theme_hook_suggestions'][] = "profile2__profile__{$vars['view_mode']}";
<?php
/**
* Returns TRUE if current page is correct.
*
* @return bool
*/
function _is_correct_page() {
$result =& drupal_static(__FUNCTION__);
if (!isset($result)) {
<?php
/**
* Implements hook_preprocess_html().
*/
function hook_preprocess_html(&$vars) {
$vars['theme_hook_suggestion'] = 'html__custompage';
}
<?php
/**
* Implements hook_theme_registry_alter().
*/
function hook_theme_registry_alter(&$registry) {
$path = drupal_get_path('module', 'my_module') . '/templates';
$registry += drupal_find_theme_templates($registry, '.tpl.php', $path);
}
<?php
/**
* Implements hook_libraries_info().
*/
function module_name_libraries_info() {
$libraries['jquery_easy_confirm_dialog'] = array(
'name' => 'Jquery easy confirm dialog plugin',
'vendor url' => 'http://www.projectshadowlight.org/jquery-easy-confirm-dialog/',
'download url' => 'http://github.com/wiggin/jQuery-Easy-Confirm-Dialog-plugin/raw/master/jquery.easy-confirm-dialog.js',
'version arguments' => array(