Error when clicking toggle icon

Created on 3 February 2025, 22 days ago

Problem/Motivation

We've been using this module for a while on a site and it's worked great. We've noticed though that it now errors when you click the publish/unpublish icon.

When clicked, the icon doesn't change colour. An ajax error is thrown in Chrome console and an error is also recorded in the Watchdog log.

The paragraph DOES still get published/unpublished and, when you re-edit the page, the icon has changed to the correct colour. So it's just the immediate click/change that is the issue.

Chrome Console error:

ajax.js?v=10.3.10:196 Uncaught 

Drupal.AjaxError {message: '\nAn AJAX HTTP error occurred.\nHTTP Result Code: 40…Text: \r\n405 Not Allowed\r\n405 Not Allowed\r\nnginx\r\n', name: 'AjaxError', stack: 'Error\n    at https://dev-adaptive-phoenix.pantheon…antheonsite.io/core/misc/ajax.js?v=10.3.10:1922:3'}

message: "\nAn AJAX HTTP error occurred.\nHTTP Result Code: 405\nDebugging information follows.\nPath: /layout-paragraphs-toggle-publish/c046d4d8a0215e3a71c13084b497fce0/toggle-publish/948f80d8-8ffb-4bd5-be58-4b8911ea2d20\nStatusText: error\nResponseText: \r\n405 Not Allowed\r\n405 Not Allowed\r\nnginx\r\n"

name: "AjaxError"

stack: "Error\n    at https://dev-adaptive-phoenix.pantheonsite.io/core/misc/ajax.js?v=10.3.10:196:32\n    at https://dev-adaptive-phoenix.pantheonsite.io/core/misc/ajax.js?v=10.3.10:1922:3"

[[Prototype]]: Error at https://dev-adaptive-phoenix.pantheonsite.io/core/misc/ajax.js?v=10.3.10:196:32 at https://dev-adaptive-phoenix.pantheonsite.io/core/misc/ajax.js?v=10.3.10:1922:3

(anonymous)	@	ajax.js?v=10.3.10:196
(anonymous)	@	ajax.js?v=10.3.10:1922

Watchdog error:
Notice: Only variables should be passed by reference in Drupal\layout_paragraphs_toggle_publish\Controller\TogglePublish->toggle() (line 72 of /code/web/modules/composer/layout_paragraphs_toggle_publish/src/Controller/TogglePublish.php).

Steps to reproduce

Edit any node page using Layout Paragraphs and click on the green circle icon to unpublish a paragraph.

The icon colour will remain unchanged and an error message - "Oops, something went wrong. Check your browser's developer console for more details." - is displayed on-screen.

Is anyone else having the same issue? Our Drupal core version is currently 10.3.11 and PHP version is 8.3.

🐛 Bug report
Status

Active

Version

1.0

Component

User interface

Created by

🇬🇧United Kingdom SteveAllen74

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024