I'm sure it's staring me in the face but....
I've created a content type (a committee) that includes file attachments (vcard)
I'm using a listing block variation to display the committees (committee listing) in volto, but I'm not sure how to return the files in my custom listing view.
This is a simplified version of my model
<model ....>
<schema>
<field name="committee_chair_vcard" type="plone.namedfile.field.NamedBlobFile">
<description/>
<required>False</required>
<title>Chair VCard</title>
</field>
<field name="committee_vice_chair_vcard" type="plone.namedfile.field.NamedBlobFile">
<description/>
<required>False</required>
<title>Vice Chair VCard</title>
</field>
<field name="additional_text" type="plone.app.textfield.RichText">
<description/>
<required>False</required>
<title>Additional Text</title>
</field>
</schema>
</model>
This is my listing template (simplified for the sake of the question)
import PropTypes from 'prop-types';
import React from 'react';
import ContactComponent from '../../Committees/ContactComponent';
import { flattenToAppURL } from '@plone/volto/helpers';
const CommitteeListTemplate = ({ items }) => {
{items.map((item, index) => {
console.log(item);
return (
<>
...
<ContactComponent
chair_contact_info={item?.committee_chair_vcard?.download}
vice_chair_contact_info={item?.committee_vice_chair_vcard?.download}
/> ;
})}
</>
);
};
CommitteeListTemplate.propTypes = {
items: PropTypes.arrayOf(PropTypes.any).isRequired,
linkMore: PropTypes.any,
isEditMode: PropTypes.bool,
};
export default CommitteeListTemplate;
Works fine for single items
BTW... getting the vcard in the context of a single item (a single committee) is fine:
I retrieve the committee info in a content
object and the code below is enough:
<ContactComponent
chair_contact_info={content?.committee_chair_vcard?.download}
vice_chair_contact_info={content?.committee_vice_chair_vcard?.download}
/> ;
So there's something, probably obvious, that I'm missing. Maybe indexing/metadata.