This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

chris10207
chris10207

i cant get the twig import functions to work in my component

mycomponents/default.htm

{% import "macros.htm" as siteMacros %}

mycomponents/macros.htm

{% macro displayField(label, value, format, opts) %}
    {% if value %}
    <li><span>{{ label }}</span><span>{{ value }}</span></li>
    {% endif %}
{% endmacro %}

and i have the exception

Call to undefined method __TwigTemplate_2459b4195728d9d8627ff99f4062ce6adfd3d07a72df8837094b0fdd63d38250::getdisplayField()
// line 50
echo $context["siteMacros"]->getdisplayField("Estimated Value", $this->getAttribute((isset($context["project"]) ? $context["project"] : null), "estimated_value", array()));
Eoler
Eoler

chris10207 said: i cant get the twig import functions to work in my component

Twig @import is not supported: https://octobercms.com/docs/markup/templating

chris10207
chris10207

thanks hmmm, let's ask for his support then :)

1-3 of 3

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.