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_language_switch_links_alter(). | |
*/ | |
function mymodule_language_switch_links_alter(array &$links, $type, $path) { | |
global $language; | |
if ($type == LANGUAGE_TYPE_INTERFACE && isset($links[$language->language])) { | |
foreach ($links as $langcode => &$link) { | |
// If no translation exists, redirect to frontpage |
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_menu(). | |
*/ | |
function mymodule_menu() { | |
$items = array(); | |
// PUBLIC PAGES |
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 | |
$report = array( | |
'skips'=>0, | |
'updates'=>0, | |
'deletes'=>0, | |
'additions'=>0 | |
); // ?? | |
$source = "Sometime drupal sucks"; | |
$translation = "Drupal C DLA BALLE"; |
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 mymodule_node_view($node, $view_mode, $langcode) { | |
// Mimic rabbit-hole module | |
if (node_is_page($node)) { | |
// Access denied: | |
drupal_access_denied(); | |
drupal_exit(); | |
// Page not found: |
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
# Ignore configuration files that may contain sensitive information. | |
sites/*/*settings*.php | |
# Ignore paths that contain generated content. | |
cache/ | |
files/ | |
sites/*/files | |
sites/*/private | |
# Server configuration files |
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_query_alter(). | |
* | |
* Adds a tag management named "query_debug" that permits to retrieve | |
* the concerned request implementing this tag. | |
* Only for development use. Custom requests SHOULDN'T implement this tag in a | |
* production website. | |
*/ |
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_preprocess_media_views_view_media_browser() | |
*/ | |
function mymodule_preprocess_media_views_view_media_browser(&$vars) { | |
foreach ($vars['rows'] as $delta => $row) { | |
if ($row->filemime == 'application/pdf') { | |
// See http://drupal.org/node/1743040 | |
$vars['rows'][$delta]->preview = l( |
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 field.tpl.php | |
* See http://api.drupal.org/api/drupal/modules!field!theme!field.tpl.php/7 | |
* | |
* Theme suggestions: | |
* - field.tpl.php | |
* - field--TYPE.tpl.php | |
* - field--NAME.tpl.php | |
* - field--CONTENT_TYPE.tpl.php |
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 your_module_form($form, &$form_state) { | |
// Your form definition | |
// Google Analytics event | |
$form['#attached'] = array( | |
'js' => array( | |
'(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 | |
/** | |
* Implements hook_css_alter(). | |
*/ | |
function yourtheme_css_alter(&$css) { | |
// Do not use jQuery UI defaults | |
$yourtheme = drupal_get_path('theme', 'yourtheme'); | |
foreach(array('theme', 'tabs', 'accordion') as $file) { | |
if (isset($css['misc/ui/jquery.ui.'.$file.'.css'])) { |