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
/** | |
* Implements hook_form_alter(). | |
*/ | |
function fortytwo_form_alter(&$form, &$form_state, $form_id) { | |
switch ($form_id) { | |
case 'block_admin_display_form': | |
$form['#attached']['js'] = array( | |
drupal_get_path('theme', 'fortytwo') . '/js/mousetrap.js' => array( | |
'scope' => 'footer', | |
), |
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
/** | |
* param string $module | |
* Name of the module. | |
* | |
* return int | |
* 1 or 0 | |
*/ | |
function is_module_enabled($module) { | |
$result = db_query('SELECT s.status FROM system s WHERE s.name = :name AND s.type = :type', array(':name' => $module, ':type' => 'module')); | |
$record = $result->fetchObject(); |
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
@mixin breakpoint($point) { | |
@if $point == desktop { | |
// Larger than tablets. | |
@media (min-width: 1210px) { @content; } | |
} | |
@else if $point == tablet { | |
// Tablets, go from 4 to 2 and 2 to 1. | |
@media (max-width: 1209px) { @content; } | |
} | |
@else if $point == mobile { |
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
include_once DRUPAL_ROOT . '/includes/utility.inc'; | |
$nodetype = ''; | |
$instances = field_info_instances('node', $nodetype); | |
$fields = array(); | |
foreach ($instances as $instance) { | |
unset($instances[$instance['field_name']]['id'], $instances[$instance['field_name']]['field_id']); |
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
jQuery.support.localstorage = function() { | |
var mod = 'modernizr'; | |
try { | |
localStorage.setItem(mod, mod); | |
localStorage.removeItem(mod); | |
return true; | |
} catch(e) { | |
return false; | |
} | |
} |
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
// Load plugins | |
var gulp = require('gulp'), | |
sass = require('gulp-ruby-sass'), | |
autoprefixer = require('gulp-autoprefixer'), | |
minifycss = require('gulp-minify-css'), | |
jshint = require('gulp-jshint'), | |
uglify = require('gulp-uglify'), | |
imagemin = require('gulp-imagemin'), | |
rename = require('gulp-rename'), | |
clean = require('gulp-clean'), |
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
var StorageUnit = (function() { | |
var is_supported = function() { | |
try { | |
return 'localStorage' in window && window['localStorage'] !== null; | |
} catch (e) { | |
return false; | |
} | |
}; | |
var _ = window.StorageUnit = { |
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
$field_name = ''; | |
$entity_name = ''; | |
$entity = entity_get_info($entity_name); | |
foreach ($entity['bundles'] as $key => $value) { | |
$field_instance = field_info_instances($entity_name, $key); | |
$instance = $field_instance[$field_name]; | |
field_delete_instance($instance); | |
} |
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 | |
$entity_type = ''; | |
$old_bundle = ''; | |
$new_bundle = ''; | |
$fields = array( | |
'field_name', | |
); | |
foreach ($fields as $field) { |
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 hook_watchdog(array $log_entry) { | |
$severity_list = array( | |
WATCHDOG_EMERGENCY => t('Emergency'), | |
WATCHDOG_ALERT => t('Alert'), | |
WATCHDOG_CRITICAL => t('Critical'), | |
WATCHDOG_ERROR => t('Error'), | |
WATCHDOG_WARNING => t('Warning'), | |
WATCHDOG_NOTICE => t('Notice'), | |
WATCHDOG_INFO => t('Info'), |
OlderNewer