Skip to content

Instantly share code, notes, and snippets.

View rupertj's full-sized avatar

Rupert Jabelman rupertj

View GitHub Profile
@rupertj
rupertj / merge item_list items.php
Created November 29, 2012 17:00 — forked from waako/merge item_list items.php
merge two items to be rendered in item_list
$variables['planning'] = array(
'#theme' => 'item_list',
'#items' => array(),
'#attributes' => array(
'class' => 'icons-info unstyled floated',
)
);
$all_terms = array_merge($variables['field_bbcgf_planning'], $variables['field_bbcgf_diet'], $variables['field_bbcgf_healthy']);
@rupertj
rupertj / isset_test
Created April 12, 2013 08:46
PHP isset tests
<?php
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', '1');
define('LANGUAGE_NONE', 'und');
echo "<pre>";
// Test an object with an array as a property.
if (isset($node->field[LANGUAGE_NONE][0]['value'])) {
$parameters = new MenuTreeParameters();
$parameters->setMaxDepth(2)->onlyEnabledLinks();
$menuTreeService = Drupal::menuTree();
$tree = $menuTreeService->load('main', $parameters);
if ($tree) {
$build = $menuTreeService->build($tree);