Skip to content

Instantly share code, notes, and snippets.

@Brian-Clement
Brian-Clement / .lando.yml
Created February 20, 2020 18:59 — forked from mikeshiyan/.lando.yml
Landofile for running Nightwatch JS tests in Drupal.
name: nightwatch-test
recipe: drupal8
config:
webroot: web
services:
appserver:
build_as_root:
# Install nodejs and yarn in the main container. They have to live here
# because PHP is required for the site installation and other ops in
# nightwatch tests.
@Brian-Clement
Brian-Clement / .lando.yml
Last active April 10, 2019 21:57
Drupal Core Lando config
name: drupal-core
recipe: drupal8
config:
webroot: drupal
services:
node:
type: node:10
tooling:
phpunit:
service: appserver
@Brian-Clement
Brian-Clement / theme.theme
Created December 6, 2018 19:38
Custom header region template suggestions based on node type
/**
* Implements hook_theme_suggestions_region_alter().
*/
function THEME_NAME_theme_suggestions_region_alter(&$suggestions, $variables) {
// Create custom header template suggestions for specific node types.
if ($variables['elements']['#region'] == 'header') {
$node = \Drupal::routeMatch()->getParameter('node');
$node_bundles = ['article', 'blog'];
if ($node instanceof \Drupal\node\NodeInterface) {
if (in_array($node->bundle(), $node_bundles)) {
@Brian-Clement
Brian-Clement / FRIEDA-3.md
Created October 22, 2018 18:25 — forked from labbydev/FRIEDA-3.md
FRIEDA Session 3 Notes

FRIEDA Session 3

Search solutions

  • Currently is search by location
  • Would like to make it more of a directory
  • View by alpha, more like a directory in the future (in page search, possibly)
    • Low use case and we don't really want people searching by location
    • in page search (basically replication Command+F)
  • potentially search by ID
  • potentially search by name
    • remove search by code/ID (and do not display that information)
@Brian-Clement
Brian-Clement / isLayoutBuilderRoute.php
Last active August 22, 2018 15:40
Check if you're on a Layout Builder route
// Check the current route to see if we are on a Layout Builder page.
// If so, return without doing anything.
$route = \Drupal::routeMatch()->getRouteObject();
$isLayoutBuilderRoute = ($route->getOption('_layout_builder') ?: null);
if ($isLayoutBuilderRoute) {
return;
}
/*!
* Scroll Sneak
* http://mrcoles.com/scroll-sneak/
*
* Copyright 2010, Peter Coles
* Licensed under the MIT licenses.
* http://mrcoles.com/media/mit-license.txt
*
* Date: Mon Mar 8 10:00:00 2010 -0500
*/