You are here

protected function UsageEventSubscriber::getRemoteMediaId in Bynder 8.3

Same name and namespace in other branches
  1. 4.0.x modules/bynder_usage/src/EventSubscriber/UsageEventSubscriber.php \Drupal\bynder_usage\EventSubscriber\UsageEventSubscriber::getRemoteMediaId()

Returns the remote media ID.

Parameters

\Drupal\media\MediaInterface $media: The media to get the remote ID for.

Return value

mixed|null The remote media ID or NULL if not found.

2 calls to UsageEventSubscriber::getRemoteMediaId()
UsageEventSubscriber::onDeleteBySourceEntity in modules/bynder_usage/src/EventSubscriber/UsageEventSubscriber.php
Triggers when the source entity is deleted.
UsageEventSubscriber::onDeleteByTargetEntity in modules/bynder_usage/src/EventSubscriber/UsageEventSubscriber.php
Triggers if the target (media) entity is deleted. Remove all Bynder usages.

File

modules/bynder_usage/src/EventSubscriber/UsageEventSubscriber.php, line 82

Class

UsageEventSubscriber
Listens for the usage events from Entity Usage module.

Namespace

Drupal\bynder_usage\EventSubscriber

Code

protected function getRemoteMediaId(MediaInterface $media) {
  $source_plugin = $media
    ->getSource();
  if (!$source_plugin instanceof Bynder) {
    return NULL;
  }
  return $source_plugin
    ->getSourceFieldValue($media);
}