grav-plugin-assets icon indicating copy to clipboard operation
grav-plugin-assets copied to clipboard

The Assets Plugin Can Break The Form Plugin Modular Page Support

Open dmitry-v-vlasov opened this issue 9 years ago • 4 comments
trafficstars

This code block breaks modular pages support in the grav forms plugin somehow (didn't dig it deep):

assets.php

    public function onPageInitialized()
    {
        // ...
                // Initialize all page content up front before Twig happens
        if (isset($page->header()->content['items'])) {
           foreach ($page->collection() as $item) {
               $item->content(); // <-- HERE
           }
        } else {
            // ...
        }
        // ...
    }

The "form" instance of "Grav/Plugin/Form" seems not "visible" in the form.html.twig template; Or it is never called after module content() calls produce some stuff already before the event "onTwigSiteVariables" which is important for the Forms plugin... Not sure...

It might be the page http://demo.getgrav.org/deliver-skeleton/contact is also broken due to the same problem. The page has an empty form in the generated sources instead of a contact form.

dmitry-v-vlasov avatar Feb 07 '16 18:02 dmitry-v-vlasov

If I comment out the above for cycle my contact form is generated successfully.

dmitry-v-vlasov avatar Feb 07 '16 18:02 dmitry-v-vlasov

Replicated. Calling $item->content(); makes the form disappear. @rhukster any clue why this might happen?

flaviocopes avatar Feb 14 '16 10:02 flaviocopes

I've got the same problem. As soon as I enable the Assets plug-in, modular forms are no longer populated. The form's container HTML is still rendered, but no dynamic content, such as input fields and buttons is created.

gmpreussner avatar Apr 25 '18 20:04 gmpreussner

Might be related to https://github.com/getgrav/grav-plugin-shortcode-core/issues/47 ?

gmpreussner avatar Apr 25 '18 20:04 gmpreussner