Search code examples
javascriptapostrophe-cms

options for areas in apostrophe apos-widgets


I want to create a sort of a wrapper widget - one that would have two areas, each with same available widgets. I configure it like it was described in documentation, but it seems that the options object from index.js isn't passed.

If in index.js I have:

module.exports = {
    extend: 'apostrophe-widgets',
    name: 'block-full-two',
    label: 'Fullscreen block',
    addFields: [{
            name: 'left',
            type: 'area',
            label: 'Left area',
            options: {
                widgets: {
                    'apostrophe-rich-text': {(...)}
                }
            },
            contextual: true
        }
        (...)
    ]
}

and in widget.html:

{{ apos.area(data.widget, 'left') }}

then area gets created, but when I click the plus icon, the list of available widgets is empty. But when I pass the widgets directly in widget.html: {{ apos.area(data.widget, 'left', { widgets: {...}}) }}, it works. Is there something I've been doing wrong?


Solution

  • I've opened an issue for this in github as this has come up internally https://github.com/punkave/apostrophe/issues/1096

    For now, you should explicitly pass those options right into the template.