Allow external caller to set current asset in the source plugin

Created on 28 September 2020, over 4 years ago
Updated 29 October 2024, 2 months ago

Problem/Motivation

On media save, the AcquiadamAsset source plugin makes calls to fetch the current asset, and its metadata.

Since callers to save the media may already have the asset and its metadata (from API requests to the DAM to retrieve this info in batches), it would be great if they could inject this so that additional calls to the DAM are avoided.

When synchronizing hundreds or thousands of items from the DAM, this quickly leads to 'too many requests' exceptions from the DAM.

Steps to reproduce

Proposed resolution

Add a AcquiadamAsset::setCurrentAsset() method.

Sample usage:

      // We already have the asset, prevent acquiadam from making the call.
      /** @var \Drupal\media_acquiadam\Plugin\media\Source\AcquiadamAsset $source */
      $source = $media->getSource();
      $source->setCurrentAsset($this->asset);
      $media->save();

Remaining tasks

User interface changes

API changes

Data model changes

✨ Feature request
Status

Closed: won't fix

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States jhedstrom Portland, OR

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024