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 | |
/** | |
* Implements hook_field_attach_view_alter(). | |
*/ | |
function MYMODULE_field_attach_view_alter(&$output, $context) { | |
foreach (element_children($output) as $field_name) { | |
$element = &$output[$field_name]; | |
if (!empty($element['#entity_type']) && !empty($element['#field_name']) && !empty($element['#bundle'])) { | |
$instance = field_info_instance($element['#entity_type'], $element['#field_name'], $element['#bundle']); |
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($) { | |
Drupal.behaviors.FakeFacets = { | |
facetClicked: function(event) { | |
var $source = $(event.srcElement || event.target) | |
value = $source.data('value'), | |
$litem = $source.parent() | |
$list = $litem.parent(), | |
$wrapper = $list.parent(), | |
$target = $wrapper.data('target_select'); |
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 | |
/** | |
* Helper to prepare field renderable array for views extra fields. | |
*/ | |
function _feature_commons_extra_field_view($field_name, $title, $entity, $view_mode, $langcode, $field_content, $access = TRUE, $entity_type = 'node') { | |
if (empty($field_content)) { | |
return ''; | |
} |
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 | |
/** | |
* @file | |
* Install, update and uninstall functions for the myprofile installation profile. | |
*/ | |
/** | |
* Implements hook_install(). | |
* | |
* Performs actions to set up the site for this profile. |
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 | |
/* | |
* Implements hook_date_format_types(). | |
*/ | |
function mymodule_date_format_types() { | |
variable_set('date_format_date_only', 'd/m/Y'); | |
variable_set('date_format_date_only_evt', 'd F Y'); | |
return array( | |
'date_only' => t('Date only'), |
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 myfunction() { | |
// Do sth on resize. | |
} | |
$(function() { | |
var intervalId; | |
$(window).resize(function(e) { | |
clearTimeout(intervalId); | |
intervalId = setTimeout(myfunction, 200); | |
}); |
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 if ($main_menu): ?> | |
<div id="main-menu" class="navigation"> | |
<?php print theme('links__system_main_menu', array( | |
'links' => $main_menu, | |
'attributes' => array( | |
'id' => 'main-menu-links', | |
'class' => array('links', 'clearfix'), | |
), | |
'heading' => array( | |
'text' => t('Main menu'), |
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 | |
/** | |
* Implements hook_permission(). | |
*/ | |
function MYMODULE_permission() { | |
return array( | |
'view contextual tabs' => array( | |
'title' => t('View contextual tabs'), | |
'restrict access' => TRUE, |
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 | |
/** | |
* Download a file to the destination and save it into drupal managed files. | |
* | |
* @param String $url | |
* The file to download URL. | |
* @param String $destination | |
* The path where the file will be stored. Can be a drupal stream like | |
* "public://my_dowloads" for example. |
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
<a href="<?php echo $link_url; ?>" class="<?php echo $link_class; ?>"><?php echo $link_title; ?></a> |