Alexander Solonik Alexander Solonik - 2 months ago 19
Twig Question

what exactly is haswidgets and widgets in bolt (or twig rather )?

I was just going through the Default theme of bolt CMS, and i came actoss the following lines of code:

{% if haswidgets('aside_top') %}

{{ widgets('aside_top') }}

{% else %}


I googled
twig haswidgets
and also
twig widgets
, but i could't find anything.

can somebody explain what these two methods are ? and what exactly do they do ?

Answer

They are a feature of Bolt. Extensions can push content to specific places in the backend and also to some places in the frontend, as long as the theme supports that. They are called widgets. the haswidgets() and widgets() twig functions are for checking and displaying them.

You can find more info here https://docs.bolt.cm/3.1/templating/widgets and here https://docs.bolt.cm/3.1/extensions/intermediate/widgets

Comments