EmbedCodeFactory::getSelectOptions performance improvements

Created on 31 July 2025, 3 days ago

Problem/Motivation

Everytime \Drupal\acquia_dam\EmbedCodeFactory::getSelectOptions is called, the allowed image styles are calculated, even if the asset type is not image.

It also recalculates the thumbnail option on each call.

Steps to reproduce

\Drupal\acquia_dam\Plugin\CKEditor5Plugin\MediaEmbedCode::getDynamicPluginConfig calls \Drupal\acquia_dam\EmbedCodeFactory::getSelectOptions multiple times.

Proposed resolution

1. Only populate `image` if asset type is null or image
2. Statically cache the results for future calls in the same request

Remaining tasks

User interface changes

API changes

Data model changes

✨ Feature request
Status

Active

Version

1.1

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States mglaman WI, USA

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

Comments & Activities

Production build 0.71.5 2024