upline / opencart-twig-helper
description
1.0.0
2023-12-14 16:09 UTC
Requires
- php: ^7.0|^8.0
- twig/twig: ^3.0
README
This package provides some macros and functions to help you work with twig templates in Opencart 3.x
Installation
composer require twom/twig-helper
For twig 3.x:
Add to system/library/template/twig.php
$loader->addPath(DIR_VENDOR . 'upline/opencart-twig-helper/src/twig/');
Usage
{% import "twig_helper_forms.twig" as forms %}
{# Render form field wrapper #}
{{ forms.field('field_name_that_used_for_label_for_attribute_and_input', rendered_element_form, label_usually_entry_something) }}
{# Render element form #}
{{ forms.input('field_name_that_used_for_label_for_attribute_and_input', value, {required: true}) }}