-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
See this discussion: getgrav/grav-plugin-admin#2259
A custom modal button made like explained in the doc is not working when you are in edit page view. The button is displayed, but when you click on it a JS error prints.
admin.min.js?59588e338c:683 Uncaught TypeError: Cannot read properties of undefined (reading 'open')
at HTMLAnchorElement.<anonymous> (admin.min.js?59588e338c:683:56)
at HTMLDocument.dispatch (jquery-2.x.min.js?59588e338c:3:7537)
at r.handle (jquery-2.x.min.js?59588e338c:3:5620)
It seems the file https://github.com/trilbymedia/grav-plugin-flex-objects/blob/develop/admin/templates/flex-objects/types/pages/edit.html.twig is missing some definition.
Adding a few lines before the closing if at the line 212
grav-plugin-flex-objects/admin/templates/flex-objects/types/pages/edit.html.twig
Lines 210 to 215 in f2a044a
| <div class="remodal" data-remodal-id="modal-page-copy" data-remodal-options="hashTracking: false, closeOnOutsideClick: false"> | |
| {% include 'partials/blueprints-copy.html.twig' with { blueprints: admin.blueprints('admin/pages/copy'), data: data({ title: object.title ~ ' (Copy)', folder: object.slug ~ '-copy' }), form_id: 'copy' } %} | |
| </div> | |
| {% endif %} | |
| {# TODO: regular pages support extra modals from admin config #} |
seems to work, here are the lines:
{% for key, add_modal in config.plugins.admin.add_modals %}
<div class="remodal {{ add_modal.modal_classes|defined('') }}" data-remodal-id="modal-add_modal-{{ key }}" data-remodal-options="hashTracking: false, closeOnOutsideClick: false">
{% include add_modal.template|defined('partials/blueprints-new.html.twig') with {
form: null,
blueprints: admin.blueprints(add_modal.blueprint),
data: null,
form_id: 'add-modal'
}|merge(add_modal.with|defined({})) %}
</div>
{% endfor %}
Sorry i can't make a proper PR as git is not configured on my grav.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels