- Issue created by @dpagini
Getting an error while using "bynder_sns" module.
Error: Call to a member function toLink() on array in Drupal\bynder_sns\EventSubscriber\NotificationSubscriber->onNotification() (line 121 of /code/docroot/modules/contrib/bynder/modules/bynder_sns/src/EventSubscriber/NotificationSubscriber.php).
The error appears to be coming from this code...
$mids = $query
->condition($source_field_condition)
->execute();
if ($mids) {
$media = $storage->loadMultiple($mids);
$bynder_media_entities = [
$message['media_id'] => $media,
];
$updated = $this->bynder->updateMediaEntities($bynder_media_entities);
if ($updated) {
$this->loggerFactory->get('bynder_sns')->notice('Updated bynder asset @label (@media_id)', [
'link' => $media->toLink($this->t('View'))->toString(),
'@media_id' => $message['media_id'],
'@label' => $media->label(),
]);
}
Where $media
is coming back as an array. Maybe we need a $media = reset($media);
? Or do we intend to handle multiple entities, which I think I've seen on my site, but not sure how that came about...
Active
4.0
Code