fabpot/Twig — Issue #653: Dynamic inheritance
Author: lucassouza1
Created: 2012-03-01 16:52:16+00:00
State: open

I include a template that is a proxy to another:
```twig
{% extends 'html/field/type/' ~ field.type ~ ".html" %}
```

but all instances use the same as the first item value. This happens because parent is created just once:
´´´php

public function getParent(array $context)
{
if (null === $this->parent) {
$this->parent = (("html/field/type/" . $this->getAttribute((isset($context['field']) ? $context['field'] : null), "type", array(), "any", false, 1)) . ".html");
if (!$this->parent instanceof Twig_Template) {
$this->parent = $this->env->loadTemplate($this->parent);
}
}

return $this->parent;
}
´´´

There's a way to use dynamic inheritance?