Skip to content

Instantly share code, notes, and snippets.

View michaelhagedon's full-sized avatar
🎯
Focusing

Michael Hagedon michaelhagedon

🎯
Focusing
View GitHub Profile
<?php
use Drupal\Core\Template\TwigReferenceFunction;
use Drupal\Core\Template\TwigTemplate;
use Drupal\Core\Template\TwigNodeExpressionGetAttrReference;
use Drupal\Core\Template\TwigNodeExpressionNameReferenceEnd;
use Drupal\Core\Template\TwigNodeExpressionNameReference;
use Drupal\Core\Template\TwigReferenceNodeVisitor;
function twig_change(&$context, $template, $val) {
public function loadUserByUsername($username)
{
$attributes = $this->container->get('security.context')->getToken()->getAttributes();
return new LtiUser($username, $attributes);
}
@michaelhagedon
michaelhagedon / .htaccess
Created April 17, 2013 20:15
A modified Symfony2 .htaccess file that makes it possible to set the front controller from the Apache virtual host (kind of like Rails).
<IfModule mod_rewrite.c>
RewriteEngine On
### Call the correct front controller. This is dependent on an environment variable being set
### in the virtual host configuration. SetEnv seems not to work, so here's an example with SetEnvIfNoCase:
### <Directory /path/to/application/web>
### SetEnvIfNoCase REQUEST_URI .* SYMFONY_ENV=dev
### </Directory>
### This will force the following rules to call the dev front controller.