I recently learnt to create custom helpers and i came across the following lines of code in the helper docs:
use StringTemplateTrait;
protected $_defaultConfig = [
'errorClass' => 'error',
'templates' => [
'label' => '<label for="{{for}}">{{content}}</label>',
],
];
(I don’t know how to use this template yet)
What i want to do is to develop a MenusHelper that will take up an array of nested children and will create a multilevel menu. But I want it to be flexible enough so users can add custom html before and after the “ul’s” and “li’s”.
I searched for StringTemplate & StringTemplateTrait but did not get anything else other than just the api guide.
So I have these question is mind:
- Am i looking for the right thing?
- If yes, Where can i get more help to understand these concepts?