Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* Implements hook_preprocess_HOOK().
*
*/
function MYTHEME_preprocess_html(&$vars) {
// Fixes page titles for login, register & password.
switch (current_path()) {
case 'user':
$vars['head_title_array']['title'] = t('Login');
<?php
/*
* Bootstrap override
* make dropdown menus do dropdown on hover,
* and allow parent link to be clickable
*/
// place this in your styles
ul.nav li.dropdown:hover > ul.dropdown-menu{
display: block !important;
<?php
/**
* Implements hook_form_alter().
To Replace the -Any- value in filters by it's label text
*/
function theme_form_alter(&$form, &$form_state, $form_id) {
kpr($form);
if ($form['#id'] == 'views-exposed-form-admin-people-block-1') {
// $my_label = 'label name';
<?php
/**
* Implements hook_form_alter().
To Replace the -Any- value in filters by it's label text
*/
function theme_form_alter(&$form, &$form_state, $form_id) {
kpr($form);
if ($form['#id'] == 'views-exposed-form-admin-people-block-1') {
// $my_label = 'label name';
<?php
/**
* Implements hook_form_alter().
To Replace the -Any- value in filters by it's label text
*/
function mp_form_alter(&$form, &$form_state, $form_id) {
kpr($form);
if ($form['#id'] == 'views-exposed-form-admin-people-block-1') {
// $my_label = 'label name';
@waako
waako / merge item_list items.php
Created November 29, 2012 18:21 — forked from rupertj/merge item_list items.php
merge two items to be rendered in item_list
$variables['planning'] = array(
'#theme' => 'item_list',
'#items' => array(),
'#attributes' => array(
'class' => 'icons-info unstyled floated',
)
);
$all_terms = array_merge($variables['field_bbcgf_planning'], $variables['field_bbcgf_diet'], $variables['field_bbcgf_healthy']);
@waako
waako / get_paragraph_type_from_field.php
Last active April 27, 2016 15:28 — forked from jenitehan/get_paragraph.php
Get paragraph type of child field item
<?php
/**
* Implements hook_preprocess_HOOK for field--field-structured-content-section.html.twig
*/
function TEMPLATE_preprocess_field__field_structured_content_section(&$variables) {
$items = $variables['items'];
foreach ($items as &$item) {
$paragraph = $item['content']['#paragraph'];
$para_type = $paragraph->getType();
@waako
waako / gulpfile.js
Created February 20, 2017 18:07
Gulpfile.js v4
var gulp = require('gulp'),
fs = require('fs'),
path = require('path'),
naturalSort = require('gulp-natural-sort'),
browserSync = require('browser-sync'),
cp = require('child_process'),
rsync = require('gulp-rsync'),
rev = require('gulp-rev'),
del = require('del'),
collect = require('gulp-rev-collector'),
@waako
waako / gulpfile.js
Created February 20, 2017 18:42
Build Script for SideCarMT.com
var gulp = require('gulp');
var fs = require('fs');
var del = require('del');
var htmlreplace = require('gulp-html-replace');
var uglify = require('gulp-uglify');
var minifyHTML = require('gulp-minify-html');
var minifyCSS = require('gulp-minify-css');
var rename = require("gulp-rename");
var bowerSrc = require('gulp-bower-src');
var gulpFilter = require('gulp-filter');