Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

correctly dispatch pre set metadata event #612

Merged
merged 2 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading