DAM Media not working on translation

Created on 22 April 2025, 3 months ago

Problem/Motivation

I'm receiving 'Media items cannot be added from this form, only through the media library when editing content.' error while trying to translate Acquia DAM Media, also the form gets disabled so I'm unable to save the translation. I found the issue comes from line 397 in version 1.1.1 in acquia_dam/acquia_dam.module

Steps to reproduce

1) Have a Drupal 10 multilanguage site running.
2) Create media pulling from DAM and add extra fields.
3) Get into DAM Media content, select one and click translate to the desired language.
4) Try to save the translation.

Proposed resolution

Remove or tweak function
if (str_ends_with($form_id, '_add_form')) {
// Disable the save button with a warning.
// @todo figure out a better user experience rather then driving users into a dead-end street.
\Drupal::messenger()->addWarning(t('Media items cannot be added from this form, only through the media library when editing content.'));
$form['actions']['submit']['#disabled'] = TRUE;
}

Remaining tasks

Explore the best approach for this.

User interface changes

Allow user to save translation.

API changes

Data model changes

πŸ› Bug report
Status

Needs review

Version

1.1

Component

Code

Created by

πŸ‡¨πŸ‡΄Colombia pablomoto1000

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

Comments & Activities

  • Issue created by @pablomoto1000
  • πŸ‡ΊπŸ‡ΈUnited States japerry KVUO

    The form is disabled due to the asset_id, version_id, and external_id not being created on new entities. However, when editing an existing one (say, adding a new translation), these values should be there in a disabled format if you enable the field under form display.

    Therefore, its likely this warning only needs to be shown when asset_id is null. Otherwise, allow saving the form. To ensure this is okay, the MR would also need a test showing that when you add a new translation, that both the new translation and original media item get updates when the widen asset is updated.

    A separate issue should probably be made to support translations in general, which likely do not work out off the box with widen: https://community.acquia.com/acquiadam/s/article/Can-I-translate-web-pag...
    This issue does compound that problem, since there is no mapping of translated metadata fields. But since it doesn't work right now, thats a problem for another day.

Production build 0.71.5 2024