Skip to content

Instantly share code, notes, and snippets.

@chx
chx / gist:2861969
Created June 3, 2012 04:55
config presave
function presave() {
module_invoke_all('config_presave', $this);
$hook = 'config_presave';
$part = strtok($this->name, '.');
do {
$hook .= '_' . $part;
module_invoke_all($hook, $this);
} while ($part = strtok('.'));
}
@chx
chx / test.php
Created March 26, 2012 22:56
drupal_render - twig integration
<?php
define('DRUPAL_ROOT', getcwd());
require_once DRUPAL_ROOT . '/Twig/lib/Twig/Autoloader.php';
Twig_Autoloader::register();
// Almost empty class, just swaps Twig_Node_Print objects to Drupal_Twig_Node_Print objects.
class Drupal_Twig_NodeVisitor implements Twig_NodeVisitorInterface {
function enterNode(Twig_NodeInterface $node, Twig_Environment $env) {