JamesIves/bolt-cms-amp-filter

Doesn't seem to work with Bolt 3.4.6

lswest opened this issue · 7 comments

I'm currently working on an AMP-based page in Bolt. The last step to completing it is allowing use of things like inserting images using the WYSIWYG editor, which this plugin would be ideal for.

However, installing the extension, and running the composer require command has yielded no working results.

Error (Twig):

An exception has been thrown during the rendering of a template ("Notice: Undefined variable: amp") in "page.twig" at line 14.

Edit I solved the undefined variable error - it was coming from the line if ($config['debug']['show_action_log'] == true) print($amp->warningsHumanText());, as $amp isn't defined in that function. The plugin still does not properly replace an img tag with amp-img though.

At first I assumed the error indicated the extension wasn't installed correctly. ampraw, however, does yield HTML (although without amp tags). Looking at the source files, I can't explain to myself why one filter works, and the other doesn't (especially since nut debug:twig amp displays both filters).

I'm not terribly well-versed with composer, and so I'm not sure how I would even go about debugging this issue. Or is this simply some sort of incompatibility?

Thanks in advance!

Okay. I've enabled debugging manually by changing the extension's source files and have found the problem with my img tag.

As such, the extension works (though the option to display the errors causes problem). I'm leaving the issue open, as it has not yet been fixed.

Thanks @lswest - I see the issue with the debugger, I'll fix this shortly and tag the issue when its available.

@lswest This should be resolved now with the version I just pushed, tested it locally and I'm getting the correct error logging now.

@JamesIves I haven't actually tested it out yet (just looked at the commit). Wouldn't the current version fail because $config isn't defined in the function where you're using it?

You're completely right, I actually omitted that part of the code while testing this so I didn't catch that. The updated commit should solve it. Thanks!

@JamesIves I've installed 1.0.2 (newest version available), but it seems to be missing the change to the $config declaration. After adding it in manually, everything works.

I also noticed that on a server running PHP 5.5.13 with debugging turned on, it still returns the HTML after printing the errors, while PHP7 only displays the error. Not a big deal, but I figured I'd mention it.

Thanks!

Tagged a new version with the commit, thanks for testing, I'll close this issue.