Resolve #3624204 "Restrict update to metadata mapped field in media edit form for DAM media types."

Closes #3624204

Problem

Editors could modify metadata-mapped fields and locally-stored DAM asset fields directly in the Drupal media edit form. Since this metadata is owned by Acquia DAM and only updated through sync paths (manual sync, drush, cron, webhooks), allowing local edits would create data conflicts and confusion.

Changes

  • MappedFieldMediaEditFormAlter.php (new class) — When a DAM media edit form loads, any field mapped from DAM metadata is disabled (rendered read-only). In download+sync mode, the locally-stored managed image and file fields are also disabled. Synthetic map targets (e.g. acquia_dam_managed_file_description) are skipped since they aren't real entity fields. A single form-level notice explains the fields are DAM-managed and directs editors to run "Sync metadata" to update them.
  • AcquiaDamFormHooks.php — Wired MappedFieldMediaEditFormAlter into the existing form_media_form_alter hook.
  • ManagedImageField.php — Added alt_field=TRUE and alt_field_required=FALSE settings to the managed image field definition.
  • ManagedImageFieldTest.php — 4 tests verifying alt field settings, provider, and file extensions.
  • MappedFieldMediaEditFormAlterTest.php — 8 tests covering all form alter paths: non-DAM media, DAM without mapped fields, mapped fields disabled, synthetic targets skipped, download+sync mode, notice content/visibility, and missing field handling.
Edited by Pravin Gaikwad

Merge request reports

Loading
Loading