Remote Video (oEmbed) - Cannot map URL of the author/owner to field

Created on 18 September 2018, over 6 years ago
Updated 26 August 2019, over 5 years ago

I'm running Drupal 8.6.1 locally in Acquia Dev Desktop and I'm trying to add Remote Video (oEmbed) assets.

In the Media type Edit page, if I map "The URL of the author/owner" to a field, I get an error Object of class Drupal\Core\Url could not be converted to string in drupal_schema_get_field_value(). If I leave it as "- Skip field -" then I don't get the problem, but I really want to map that data so that my users don't have to enter it manually.

I have tried making the field type (of the field that I map it to) both a Link and a Text (plain), but same problem with either.

I have tried with both YouTube and Vimeo remote video and get the same problem.

Full error message below:

The website encountered an unexpected error. Please try again later.
Recoverable fatal error: Object of class Drupal\Core\Url could not be converted to string in drupal_schema_get_field_value() (line 229 of core\includes\schema.inc).

drupal_schema_get_field_value(Array, Object) (Line: 1277)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->saveToDedicatedTables(Object, 1, Array) (Line: 879)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->doSaveFieldItems(Object) (Line: 578)
Drupal\Core\Entity\ContentEntityStorageBase->doSave('75', Object) (Line: 429)
Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 774)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->save(Object) (Line: 29)
Drupal\media\MediaStorage->save(Object) (Line: 390)
Drupal\Core\Entity\Entity->save() (Line: 296)
Drupal\Core\Entity\EntityForm->save(Array, Object) (Line: 61)
Drupal\media\MediaForm->save(Array, Object)
call_user_func_array(Array, Array) (Line: 111)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 51)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 589)
Drupal\Core\Form\FormBuilder->processForm('media_living_things_remote_video_edit_form', Array, Object) (Line: 318)
Drupal\Core\Form\FormBuilder->buildForm('media_living_things_remote_video_edit_form', Object) (Line: 93)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 582)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 151)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 38)
Drupal\webprofiler\StackMiddleware\WebprofilerMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 665)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
πŸ› Bug report
Status

Active

Version

10.1 ✨

Component
MediaΒ  β†’

Last updated 1 day ago

Created by

πŸ‡ΉπŸ‡­Thailand Nick Hope

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • this issue can be fixed by changing the case 'author_url': on line 271 of /core/modules/media/src/Plugin/media/Source/OEmbed.php by the following:
    case 'author_url':
    $author_url=$resource->getAuthorUrl();
    return $author_url->getUri();
    //orig
    //return $resource->getAuthorUrl();

    not sure this is a clean code, but it works.

Production build 0.71.5 2024