Skip to content

Commit

Permalink
Elements: not necessary to have the widgetId persisted on the element…
Browse files Browse the repository at this point in the history
  • Loading branch information
dasgarner committed Sep 15, 2023
1 parent 0dc49bf commit 952ad13
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 13 deletions.
12 changes: 0 additions & 12 deletions lib/Entity/Widget.php
Expand Up @@ -973,18 +973,6 @@ public function save($options = [])
foreach ($this->widgetOptions as $widgetOption) {
// Assert the widgetId
$widgetOption->widgetId = $this->widgetId;

// Handle widgetId inside of the option value
if ($options['import'] && $widgetOption->option === 'elements') {
$widgetElements = $this->getOptionValue('elements', null);
$widgetElements = json_decode($widgetElements, true);
foreach ($widgetElements as $widgetIndex => $widgetElement) {
$widgetElements[$widgetIndex]['widgetId'] = $this->widgetId;
}

$this->setOptionValue('elements', 'raw', json_encode($widgetElements));
}

$widgetOption->save();
}
}
Expand Down
3 changes: 3 additions & 0 deletions lib/Widget/Render/WidgetHtmlRenderer.php
Expand Up @@ -585,6 +585,9 @@ private function render(

// Join together the template properties for this element, and the element properties
foreach ($widgetElements as $widgetIndex => $widgetElement) {
// Assert the widgetId
$widgetElements[$widgetIndex]['widgetId'] = $widget->widgetId;

foreach (($widgetElement['elements'] ?? []) as $elementIndex => $element) {
$this->getLog()->debug('render: elements: processing widget index ' . $widgetIndex
. ', element index ' . $elementIndex . ' with id ' . $element['id']);
Expand Down
1 change: 0 additions & 1 deletion ui/src/editor-core/widget.js
Expand Up @@ -741,7 +741,6 @@ Widget.prototype.saveElements = function(
dataType: 'json',
data: JSON.stringify([
{
widgetId: widgetId,
elements: elementsToSave,
},
]),
Expand Down

0 comments on commit 952ad13

Please sign in to comment.