Skip to content

Instantly share code, notes, and snippets.

View acabouet's full-sized avatar

Adrienne acabouet

  • Albuquerque, NM
View GitHub Profile
{
"data": {
"menuByName": {
"name": "Main navigation",
"description": "Site section links",
"links": [
{
"label": "VA Benefits nd Health Care",
"expanded": false,
"description": null,
{
menuByName(name: "main"){
name
description
links {
label
expanded
description
url {
path
@acabouet
acabouet / gist:d9a17849f7c5dbfedb88d7592c3017e7
Last active February 27, 2018 00:31
Drupal 8 - Get values as taxonomy term names from a taxonomy term reference field and print them out in a Twig template as classes. Especially handy for using with Isotope filters.
{# Create classes array. The 'node' class is required for contextual edit links. #}
{% set categories = [] %}
{% set classes = ['integration', 'node'] %}
{% for key, item in content.field_integration_cat if key|first != '#' %}
{% set categories = categories | merge([ item['#title'] | replace({' ':''}) ]) %}
{% endfor %}
{% for item in categories %}
{% set classes = classes | merge([item]) %}
@acabouet
acabouet / flatten_array.php
Created November 7, 2017 22:48
a simple PHP function to flatten an arbitrarily nested array.
$a = array('a', 'b', array(array(array('1'), '2', '3')), array(array('xyz')));
function make_flat($array,$result) {
for($i = 0; $i <= count($array); $i++) {
if(is_array($array[$i])) {
$result = make_flat($array[$i], $return);
}
else {
if(isset($array[$i])) {
$result[] = $array[$i];
@acabouet
acabouet / murdocktrust-widgetsetup.php
Created May 22, 2017 03:58
A Wordpress widget factory for a custom theme.
<?php
namespace MurdockTrust\MurdockTrust\Widgets;
class MurdockTrust_WidgetSetup {
public $widget_class = '';
public $admin_styles = array();
public $admin_scripts = array();
public $front_styles = array();
public $front_scripts = array();
@acabouet
acabouet / template.php
Created May 20, 2017 01:27
A template.php file for a responsive Drupal custom theme, showing some data processing magic to make coding easier on the front-end.
<?php
function clearesult_subsolar_preprocess_html(&$variables) {
drupal_add_css(drupal_get_path('theme', 'clearesult_subsolar') .'/build/scripts/vendor/pure.css', array('group' => CSS_SYSTEM));
drupal_add_css('//fonts.googleapis.com/css?family=Cabin:400,600', array('group' => CSS_SYSTEM));
}
function clearesult_subsolar_preprocess_page(&$variables) {
drupal_add_js(drupal_get_path('theme', 'clearesult_subsolar') .'/build/scripts/vendor/modernizr-2.8.3.min.js', array("group" => JS_LIBRARY, "weight" => 115));
drupal_add_js(drupal_get_path('theme', 'clearesult_subsolar') .'/build/scripts/vendor/jquery-maskedinput.min.js', array("group" => JS_LIBRARY, "weight" => 115));
@acabouet
acabouet / front-page.php
Created May 20, 2017 01:23
A Wordpress front-page template for a custom theme that leverages the Advanced Custom Fields plugin to create a completely dynamic homepage that's easy for content creators to update.
<?php
get_header();
global $slider_meta;
?>
<?php
// Start the loop.
while (have_posts()) : the_post();
// If comments are open or we have at least one comment, load up the comment template.
@acabouet
acabouet / a-better-setup-for-git.md
Created February 19, 2017 06:49 — forked from nepsilon/a-better-setup-for-git.md
A better setup for Git — First published in fullweb.io issue #46

A better setup for Git

Git default configuration is good but it can be personalized to improve your workflow efficiency. Here are some good lines to put in your ~/.gitconfig:

# The basics, who you commit as:
[user]
  name = John Doe
  email = john@doe.org
@acabouet
acabouet / afterignoreupdate
Created August 20, 2016 11:15
refresh after updating .gitignore
git rm -r --cached .
git add -A
git commit -am 'Removing ignored files'
@acabouet
acabouet / update_domain.module
Created September 3, 2015 11:58
Example of a custom module - this one extends the Domain contrib module to create a custom block with a region select.
<?php
function update_domain_enable() {
domain_bootstrap_register();
}
function update_domain_domain_bootstrap_full($domain) {
if (function_exists('drush_verify_cli') || function_exists('update_prepare_d7_bootstrap')) return;
module_invoke('update_domain', 'initialize', 'domain');