I am trying to create a custom apostrophe-images-widgets
layout for my site. I have currently created a project-level override for the html template in the lib/modules/apostrophe-images-widgets/views/widget.html
. The issue I have is whenever I choose an image to place into my custom area, apos.attachments.url
is called twice: once with the image I selected and again with an undefined
attachment.
My custom widget.html
looks like so:
<a href="/"><img class="logo" src="{{ apos.attachments.url(image.attachment, { size: 'full'}) }}" /></a>
My entire lib
directory looks like so:
My app.js
is setup with the default configuration.
My custom layout.html
is referencing the images like so:
{{
apos.area(data.page, 'web-logo', {
widgets: {
'apostrophe-images': {
size: 'full'
}
}
})
}}
I am not sure what other inforamtion I can give you, other than the exception is thrown here in the apostrophe-attachments/lib/api.js
:
self.url = function(attachment, options) {
options = options || {};
// THROWS ERROR AT `attachment._id`
var path = '/attachments/' + attachment._id + '-' + attachment.name;
if (!options.uploadfsPath) {
path = self.uploadfs.getUrl() + path;
}
// other code
}
I am not too sure where to even look as to find a solution... Anything else I can provide, please let me know.
I have not overridden the index.js
of apostrophe-images-widgets
or apostrophe-images
the exact error I get is long, but here is the start of the stacktrace
TypeError: Cannot read property '_id' of undefined
Not very helpful, but that's it.
Thanks for reading and any help given!