Skip to content

Instantly share code, notes, and snippets.

View zaidaldabbagh's full-sized avatar

Zaid Al-Dabbagh zaidaldabbagh

View GitHub Profile
@zaidaldabbagh
zaidaldabbagh / drupal_8_theme.theme
Last active March 10, 2021 00:18
Drupal 8 - Menu preprocess hook to fetch linked nodes and access thumbnail field values
use Drupal\node\Entity\Node;
function ncea_preprocess_menu(&$vars, $hook) {
// Subjects Nav
if ($hook == 'menu__subjects') {
foreach ($vars['items'] as $key => $item) {
if ($vars['items'][$key]['below']) {
foreach ($vars['items'][$key]['below'] as $learningAreaKey => $learningAreaItem) {
$learningAreaUrl = $learningAreaItem['url'];
@zaidaldabbagh
zaidaldabbagh / SilverStripe 3 on Heroku
Last active March 13, 2021 20:09 — forked from camfindlay/SilverStripe on Heroku
SilverStripe database setup on Heroku.
mysite/_config.php
<?php
// . . . config above
//Heroku ClearDB support
if(isset($_ENV['CLEARDB_DATABASE_URL'])) {
global $databaseConfig;
$parts = parse_url($_ENV['CLEARDB_DATABASE_URL']);
$databaseConfig['type'] = 'MySQLDatabase';
$databaseConfig['server'] = $parts['host'];
$databaseConfig['username'] = $parts['user'];