toStructure with html code?

I don’t know if the question is the right one for my problem.

I want to use the toStructure function for an easy implementation of e.g. contact informations like e-mail, social media and so on.

Now I want also have an individual icon directly in the specific text file for each contact part.

I use the icons from the css framework which I use. And I have tested following way:

Kontakt: 

-   
     kontakt_icon: <span uk-icon="icon: check"></span>
     kontakt_art: Telefon
     kontakt_info: xxx

But this will show me an error with “too many keys”. How can I solve it?

You can just store the value of the icon, then echo it in your html. That’s much cleaner than storing the html:

kontakt_icon: phone

Then in your template:

<span class="uk-icon:<?= item->icon() ?>">whatever</span>
1 Like

@texnixe

Again thanks for your solution.

I have modified it to this one and it works:

<span uk-icon="icon: <?= $kontakt->kontakt_icon() ?>"></span>