Add hook for Bynder remote media deletion handling

Created on 11 February 2025, 27 days ago

Problem/Motivation

When a media asset is deleted in Bynder, the corresponding Drupal media entity remains in the system. Currently, the module only logs this situation during cron runs but doesn't provide any mechanism for modules to react to this deletion.

Steps to reproduce

1. Set up Bynder integration

2. Create media entities using Bynder assets

3. Delete an asset in Bynder

4. Run cron

5. Observe that the media entity remains in Drupal with only a log message indicating the remote deletion

Proposed resolution

Add a new hook 'hook_bynder_media_deleted' that gets invoked when a Bynder asset is detected as deleted. This allows other modules to properly handle the cleanup of orphaned media entities.

Remaining tasks

1. Review and test the patch

2. Add tests if required

3. Update documentation to include the new hook

User interface changes

None

API changes

New hook introduced: hook_bynder_media_deleted($missing_remote_entity)

- Parameter: $missing_remote_entity (MediaInterface) - The media entity that references the deleted Bynder asset

- Purpose: Allows modules to react when a Bynder asset is deleted from the remote system

Data model changes

None

🐛 Bug report
Status

Active

Version

4.3

Component

Code

Created by

🇮🇳India ashish.poddar

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

Comments & Activities

Production build 0.71.5 2024