Is there a way to update widget A when widget B is modified/added/removed?
I've create an "alias" widget that outputs the content of any other active widget. In the admin, this widget has a drop-down
<select> element that has an option for every other active widget. I would like the
<select> menu to update when another widget is added/removed, and am not sure how to achieve this. In case this is unclear, here's an example:
Save I have one alias widget and two other widgets: one text and one calendar. So the
<select> in the alias widget shows:
Say I then drag a new pages widget into the sidebar. As soon as the widget is added, i would like the
<select> in my alias widget to auto-update to the following:
Same goes for deleting the widget or moving it to an inactive sidebar - I would like the
<select> to then auto update back to:
Is there a simple way to make this happen? Is it an ajax solution? Seems to me that I need to trigger the update function in my alias widget class whenever another widget is updated - does that sound right? If so, what filter/actions might I be looking for?
Thanks a ton, ya'll - appreciate the help!