silverstripe / silverstripe-widgets

Widgets subsystem for Silverstripe CMS
http://silverstripe.org
BSD 3-Clause "New" or "Revised" License
38 stars 55 forks source link

Widgets syncronize? #154

Closed AnonymousWebHunter closed 7 years ago

AnonymousWebHunter commented 7 years ago

Hi,

I will try to explain the problem as good as I can:

I have a strange bug with a website that utilizes widgets. I have 2 pages that utilize the same template, for example: page-name/ and the other one is page-name-2/. Both pages have a TextWidget ( a simple custom widget made by me, with title and text ).

The problem: If I change the content of the TextWidget on page-name/ it will also change the content of TextWidget on page-name-2/

I believe that when page-name-2/ was created, it was done by duplicating page-name/. If so, could this be the source of the problem ?

EDIT1: This syncronize error seems to apply to all widgets from that 2 page, not only the TextWidget.

robbieaverill commented 7 years ago

It sounds like by duplicating the page it also duplicated the has one relationships. I suppose we should add some logic to duplicate these too.

dhensby commented 7 years ago

Duplicate of https://github.com/silverstripe/silverstripe-widgets/issues/58

This issue was fixed some time ago (https://github.com/silverstripe/silverstripe-widgets/pull/59)

You need to make sure you're using the WidgetPageExtension to add widgets to pages and not just manually adding a has_one relation to WidgetArea. If you are manually adding the relationship you'll need to also manually implement the duplicate logic.