I want to give users a choice to show/hide the image title that's in apostrophe-images-widgets/views/widgetBase.html
So, I created project-level copy of apostrophe-images
module, and added the showTitle
boolean field in addFields like so:
{
type: 'boolean',
name: 'showTitle',
label: 'Show Title'
},
Also in project-level, under apostrophe-images-widgets/views/widget.html
I overrode the original widget template with this:
{%- block title -%}{% if data.widget.showTitle %}<h4>{{ image.title }}</h4>{% endif %}{%- endblock -%}
But this does not work... I guess because I'm setting the showTitle option in apostrophe-images
, but trying to use that option in apostrophe-images-widget
. What would be the correct way to implement this?
By the way, setting the option manually and then using data.option.showTitle
does work
Ok, anwering my own question here. I found that I should use image.showTitle
rather than data.widget.showTitle