Is twig working in ReportWidget? How to enable twig? #807
-
I try to use twig in report Widget, but no result: in class MembersAtRisk extends ReportWidgetBase in _widget.htm:
But the result is: {% for member in members_list %} So I suppose thata have to enable twig... But how??? |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 4 replies
-
In backend views, you cannot use twig. Use PHP. You can see how that's done in any of the backend widgets source code. |
Beta Was this translation helpful? Give feedback.
-
I encourage you to read the whole documentation, it's a good read! ;) |
Beta Was this translation helpful? Give feedback.
-
Pretty sure the documentation states that backend views use PHP... if not, PRs to the docs are always welcome. |
Beta Was this translation helpful? Give feedback.
-
ref. https://wintercms.com/docs/backend/controllers-ajax#actions-views-routing |
Beta Was this translation helpful? Give feedback.
-
Was there many times... |
Beta Was this translation helpful? Give feedback.
-
What I am saying in the end is: it is worth going through THE WHOLE documentation (many times if needed) to get a better general understanding of the beast. It would save you many days of struggle... |
Beta Was this translation helpful? Give feedback.
-
@SledgehammerPL Like this: <ul>
<?php foreach ($members_list as $member) : ?>
<li>
<?= $member->person_data_first_name ?>
</li>
<?php endforeach; ?>
</ul> |
Beta Was this translation helpful? Give feedback.
In backend views, you cannot use twig. Use PHP.
You can see how that's done in any of the backend widgets source code.