Skip to content

Instantly share code, notes, and snippets.

View pixelwhip's full-sized avatar

John Ferris pixelwhip

View GitHub Profile
@pixelwhip
pixelwhip / _l-3up.scss
Created July 7, 2013 23:57
Drupal cTools/panels custom layout. Creating dynamic layout classes based on whether or not regions have content.
//
// @file
// Sidebars After Layout.
// One main content area with two sidebars after.
// ----------------------------------------------------------------------------
.l--3up {
@include breakpoint(41em, $no-query: '.lt-ie9') {
.l-main {
@include zen-grid-item(8, 1);
@pixelwhip
pixelwhip / MODULE_NAME.module
Created December 6, 2012 23:05
Custom Block code for Drupal 7
<?php
/**
* Implements hook_block_info().
*/
function MODULE_NAME_block_info() {
$blocks['BLOCK_DELTA'] = array(
'info' => t(''),
'cache' => DRUPAL_NO_CACHE,
);
@pixelwhip
pixelwhip / template.php
Created September 4, 2012 15:38
Hides the default page title on nodes where the title is set as a field via Display Suite
/**
* Implements hook_process_page.
*/
function sipk_process_page(&$variables) {
// Remove the title from pages that have been set with Display Suite.
$content = $variables['page']['content'];
// Check to see if this is a node page.
if (isset($content['system_main']['nodes'])) {
// Grab the node render array.
@pixelwhip
pixelwhip / session.html
Created August 19, 2012 22:43
Session navigation
<h4 class="session-title">Session 1 name <a href="/whatever/page" class="session-link">Go to Session</a></h4>
<ul class="session-pages">
<li class="session-page"><a href="/whatever/page" class="session-page-link">Page 1</a></li>
<li>...</li>
<li>...</li>
</ul>
<h4 class="session-title">Session 2 name <a href="/whatever/page" class="session-link">Go to Session</a></h4>
<ul class="session-pages">
<li class="session-page"><a href="/whatever/page" class="session-page-link">Page 1</a></li>
@pixelwhip
pixelwhip / block.tpl.php
Created July 14, 2012 16:20
Modular Stylesheets - Design 4 Drupal
<?php
/**
* @file
* Default theme implementation to display a block.
*
* Available variables:
* - $block->subject: Block title.
* - $content: Block content.
* - $block->module: Module that generated the block.
// Button base
// ------------
%button {
@inlude inline-block;
&:hover {
text-decoration: none;
}
}
@pixelwhip
pixelwhip / template.php
Created May 30, 2012 13:26
Adding icons to menu links in Drupal
<?php
/**
* Custom implementation of theme_menu_link() for including icons.
*/
function cic_menu_link__icon(array $variables) {
$element = $variables['element'];
$sub_menu = '';
/* Prevent the <span> tag from being escaped */
@pixelwhip
pixelwhip / block.tpl.php
Created May 23, 2012 16:05
Drupal: Adding classes to blocks
<div id="<?php print $block_html_id; ?>" class="<?php print $classes; ?>"<?php print $attributes; ?>>
<?php print render($title_prefix); ?>
<?php if ($block->subject): ?>
<h2<?php print $title_attributes; ?>><?php print $block->subject ?></h2>
<?php endif;?>
<?php print render($title_suffix); ?>
<div <?php print $content_attributes; ?>>
<?php print $content ?>
@pixelwhip
pixelwhip / screen.scss
Created April 18, 2012 05:56
How I make blocks sexy with abstracted classes.
//
// Generic block styles
//
.block {
@include margin-trailer(1);
}
.block-rounded {
@media screen and (min-width: 420px) {
@pixelwhip
pixelwhip / template.php
Created April 18, 2012 05:43
This is simple alter function I had to write while addressing an issue on the DrupalCon site. It led to this blog post. http://pixel-whip.com/blog/12/03/all-cool-kids-back-bus
<?php
/**
* Implements hook_js_alter()
*/
function shizzle_js_alter(&$javascript) {
// Collect the scripts we want in to remain in the header scope.
$header_scripts = array(
'sites/all/libraries/modernizr/modernizr.min.js',
);