I'd really like to place a controller between the component and the template, for example:
{# /components/templates/table.twig #}
{% spaceless %}
<table {{ attributes.merge({}) }}>
{% if caption is not empty %}
<caption {{ caption.attributes }}>
{{ caption }}
</caption>
{% endif %}
{% for row in rows %}
<tr {{ row.attributes.merge({}) }}>
{% for cell in column %}
<{{ cell.type }} {{ cell.attributes.merge({}) }}>{{ cell.label ?: ' ' }}</{{ cell.type }}>
{% endfor %}
</tr>
{% endfor %}
</table>
{% endspaceless %}
<?php
/**
* /components/controllers/table.php
*/
class table
{
public function __construct($attributes)
{
if (!isset($attributes['caption']) {
throw new Error("You must define a caption to keep this accessible");
}
}
}
Is there any way to implement something like this with this library?
I'd really like to place a controller between the component and the template, for example:
Is there any way to implement something like this with this library?