Skip to content

Instantly share code, notes, and snippets.

@reubenmoes
reubenmoes / composer.json
Last active May 3, 2017 23:56
Drupal 8 Composer Boilerplate
{
"name": "drupal8-boilerplate",
"description": "Domain7 Drupal 8 base boilerplate",
"type": "project",
"license": "GPL-2.0+",
"minimum-stability": "dev",
"prefer-stable": true,
"require-dev": {
"drupal/console": "^1.0"
},
@reubenmoes
reubenmoes / template.php
Last active April 27, 2016 20:21
Drupal hook to get the Display Suite field group attributes input option to use tokens. NOTE: only works in template.php i believe, and not modules.
<?php
//@file template.php
/**
* Implements hook_field_group_pre_render_alter()
* Add token support for field group attributes
*
* NOTE: this is basically a copy/paste of field_group_pre_render_html_element()
* from the field_group module with some changes
*
@reubenmoes
reubenmoes / block.php
Created April 25, 2016 21:04
Attach JS to a drupal block
<?php
//put this in hook_bock_view
$block['content'] = array(
///....
'#attached' => array(
'css' => array(
drupal_get_path('module', 'mymodule') . '/css/mymodule.css',
),
@reubenmoes
reubenmoes / gist:5412196be668481d908f392f2ca84ebf
Created April 22, 2016 22:10
super rough block + js + drupal.settings
/**
* Implements hook_block_info().
*
* This hook declares what blocks are provided by the module.
*/
function block_example_block_info() {
// This sample shows how to provide default settings. In this case we'll
// enable the block in the first sidebar and make it visible only on
// 'node/*' pages. See the hook_block_info() documentation for these.
@reubenmoes
reubenmoes / breadcrumb.js
Created August 21, 2015 21:00
Breadcrumb
/*
* Will check if there is a breadcrumb
* on the page and exit if not. If there is a large breadcrumb, it will
* add binding to hide inner elements
*/
app.breadcrumb = (function($){
'use strict';
//Shared variables:
var selector = '.bread-crumb-nav',
@reubenmoes
reubenmoes / modernizr.csschecked.js
Created August 4, 2015 15:51
Modernizr csschecked test
/*!
{
"name": "CSS checked",
"property": ":checked",
"authors": ["richarcher"],
"tags": ["css"],
"notes": [{
"name": "Related Github Issue",
"href": "https://github.com/Modernizr/Modernizr/issues/845"
}]
@reubenmoes
reubenmoes / camelcaseVim
Created July 8, 2015 14:51
Search replace for vim to conver to camel case
:1,$s/_\([a-z]\)/\u\1/gic
@reubenmoes
reubenmoes / drupal.metatags_preprocess_html.php
Created May 21, 2015 01:46
Drupal add graph metatags with preprocess_html
/**
* Implements hook_preprocess_html()
*
* Adds open graph tags
*
* @param array $variables
*/
function module_preprocess_html(&$variables) {
/*
@reubenmoes
reubenmoes / gallery.js
Created May 14, 2015 04:11
Load Fresco.js async and bind gallery of thumbnails
@reubenmoes
reubenmoes / socialShare.js
Created May 1, 2015 17:14
socialShare.js
vec.socialShare = {
selector: '.js-share_link',
init: function() {
$(vec.socialShare.selector).click(function(event){
event.preventDefault();