Skip to content

Instantly share code, notes, and snippets.

@joelsteidl
joelsteidl / pantheon-deploy-multidev.yml
Created November 8, 2023 18:47
Proposed nysenate.gov Pantheon Multidev Workflow
name: Pantheon Deploy Multi-Dev
# Github Action triggers when a branch is created off of main named
# feature/Whatever and a pull request is opened.
on:
pull_request:
branches:
- main
env:
GITHUB_REF: ${{ github.ref }}

Totals

Language files blank comment code
XML 2 156 0 13587
PHP 157 1623 1706 8345
CSV 6 0 0 2339
YAML 45 4 0 467
JSON 6 0 0 127
JavaScript 8 22 49 91
@joelsteidl
joelsteidl / MYTHEME.theme
Created November 5, 2020 15:47
Forcing all menu links to use absolute links in Drupal 8/9
<?php
/**
* Implements hook_preprocess_menu().
*
*/
function MYTHEME_preprocess_menu(&$variables) {
// Limit to specific menus for performance.
$menus = ['main', 'footer'];
if (isset($variables['menu_name']) && in_array($variables['menu_name'], $menus)) {
@joelsteidl
joelsteidl / Drupal - httpClient Example
Last active August 4, 2018 19:34
Guzzle is part of Drupal 8 as Drupal::httpClient();
<?php
// See https://jobs.github.com/api for documentation.
$client = \Drupal::httpClient();
$params = [
'query' => [
'description' => 'laravel',
'full_time' => true,
]
];
@joelsteidl
joelsteidl / notify.module
Last active August 3, 2018 19:50
Drupal 8 - Send an SMS when a new node is created.
<?php
// Add Twilio by SDK with composer.
// CLI Command: composer require twilio/sdk.
use Twilio\Rest\Client;
use Drupal\Core\Entity\EntityInterface;
/**
* Implements hook_ENTITY_TYPE_insert().