Skip to content

Instantly share code, notes, and snippets.

Aaron Froehlich a-fro

  • Cornell University
  • Ithaca, NY
Block or report user

Report or block a-fro

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View confirm-menu-name-3099361-2.patch
diff --git a/menu_svg_icons.module b/menu_svg_icons.module
index 7ff6e74..601d52f 100644
--- a/menu_svg_icons.module
+++ b/menu_svg_icons.module
@@ -232,6 +232,10 @@ function menu_svg_icons_preprocess_block(&$variables) {
* Implements hook_preprocess_HOOK().
*/
function menu_svg_icons_preprocess_menu(&$variables) {
+ // Make sure there is a menu_name key
+ if (!isset($variables['menu_name'])) {
@a-fro
a-fro / device-support.css
Created Nov 15, 2019
Device support media queries
View device-support.css
/* smartphones, touchscreens */
@media (hover: none) and (pointer: coarse) {
/* ... */
}
/* stylus-based screens */
@media (hover: none) and (pointer: fine) {
/* ... */
}
/* Nintendo Wii controller, Microsoft Kinect */
@media (hover: hover) and (pointer: coarse) {
View ClassFilterSubscriber.php
<?php
namespace Drupal\ilr_registrations\EventSubscriber;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\EventDispatcher\Event;
use Drupal\commerce_product\Event\ProductEvents;
use Drupal\commerce_product\Event\FilterVariationsEvent;
/**
View ilr_registrations.services.yml
services:
ilr_registrations.default:
class: Drupal\ilr_registrations\EventSubscriber\ClassFilterSubscriber
arguments: []
tags:
- { name: event_subscriber }
@a-fro
a-fro / reinstall
Created Apr 12, 2018
Drupal reinstall script
View reinstall
#!/bin/bash
drush si config_installer config_installer_sync_configure_form.sync_directory=../config/sync --account-pass=admin --account-name="admin" -y
View field_layout.routing.yml
# @todo Refactor to use a dynamic RouteSubscriber
field_layout.change_layout:
path: 'admin/structure/types/manage/change-layout/{entity_type}/{bundle}/{display_mode}/{new_layout}'
defaults:
_form: '\Drupal\field_layout\Form\FieldLayoutEntityLayoutEditForm'
_title: 'Change layout'
requirements:
_permission: 'admin fields'
View FieldLayoutEntityLayoutEditForm.php
<?php
namespace Drupal\field_layout\Form;
use Drupal\Core\Entity\EntityFieldManagerInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
View hook
/**
* Implements hook_form_alter().
*/
function mymodule_form_alter(&$form, &$form_state, $form_id) {
if ($form_id == 'submenu_reorder_node_page_reorder') {
foreach (element_children($form['menu_items']) as $id) {
$menu_link = menu_link_load($id);
$url = url($menu_link["link_path"]);
$form['menu_items'][$id]['link_title']['#markup'] = '<a href="'. $url .'">'. $menu_link["link_title"] . '</a>';
}
@a-fro
a-fro / DrupalVM3.0.md
Last active May 27, 2016
Notes on upgrading to the latest/greatest DrupalVM for ILR
View DrupalVM3.0.md

Upgrading to DrupalVM 3.0 with PHP 7.0

  1. If you are in the middle of some work, feel free to create a backup of your current database, either with SequelPro, or via

    drush cc all
    drush sql-dump -l default --gzip --result-file=../db/backups/pre-vm-upgrade-$(date +%m.%d.%y-%H-%M).sql.gzip
    
  2. Remove the current environment with vagrant destroy -f

View post-checkout
#! /bin/sh
# Start from the repository root.
cd ./$(git rev-parse --show-cdup)
compass compile
You can’t perform that action at this time.