Skip to content

Commit

Permalink
correctly dispatch pre set metadata event (#612)
Browse files Browse the repository at this point in the history
* dispatch pre set metadata event for grid edits too

* dispatch pre set metadata event for batch
  • Loading branch information
AlternateIf authored Sep 13, 2024
1 parent a239604 commit ff2442f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Controller/Admin/Asset/AssetController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2330,6 +2330,12 @@ public function gridProxyAction(Request $request, EventDispatcherInterface $even
}

if ($dirty) {
$metadataEvent = new GenericEvent($this, [
'id' => $asset->getId(),
'metadata' => $metadata,
]);
$eventDispatcher->dispatch($metadataEvent, AdminEvents::ASSET_METADATA_PRE_SET);

// $metadata = Asset\Service::minimizeMetadata($metadata, "grid");
$asset->setMetadataRaw($metadata);
$asset->save();
Expand Down
6 changes: 6 additions & 0 deletions src/Controller/Admin/Asset/AssetHelperController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1054,6 +1054,12 @@ public function batchAction(Request $request, EventDispatcherInterface $eventDis

try {
if ($dirty) {
$metadataEvent = new GenericEvent($this, [
'id' => $asset->getId(),
'metadata' => $metadata,
]);
$eventDispatcher->dispatch($metadataEvent, AdminEvents::ASSET_METADATA_PRE_SET);

// $metadata = Asset\Service::minimizeMetadata($metadata, "grid");
$asset->setMetadataRaw($metadata);
$asset->save();
Expand Down

0 comments on commit ff2442f

Please sign in to comment.