Get value from custom fields in navigation-primary from CMS boilerplate
Hey! 🙂
From what I understant, you created a custom module inside of which you created two fields, and you want them to be displayed in your header.html partial?
If I'm right, the solution is indeed to use the page json informations to retrieve the fields. For that to work, you will have to loop inside the json and set some conditions to retrieve the right fields:
{% for widget in all_widgets %}
{% if widget.name == "navigation-primary "%}
{{widget.params.menu_title}}
{{widget.params.primary_menu_field}}
{% endif %}
{% endfor %}
This is a bit of a workaround (as the widget name and/or values can change). I would suggest creating those fields directly in the header section of your theme fields.json and call them in your header.html like this :
{{theme.header.menu_title}}
To provide you a better solution, it would be great if you could explain exactly what do you want to do.