Skip to content

Conversation

@romaincazier
Copy link

This PR removes the "_oembedObj" property and instead make sure the value is always an Oembed object with at least the properties empty and url (what’s input in the field).

The key functions (among other bits) to make this work with an InputfieldURL descendant were FieldtypeOembed::sanitizeValue and InputfieldOembed::setAttributeValue.

This resolves the issue with Pagefile/image’s custom field mentioned here.

Of course I invite you to examine first and also try before merging to make sure I didn’t miss something.

(I’m doing this first as I wanted to add the ability for the field to hold a local copy of the thumbnail, unless you’re also working on this?)

@romaincazier
Copy link
Author

romaincazier commented Jul 21, 2023

Actually, reading from the README, the one thing it changes is that __toString() returns the url instead of the html (from my testing this is required by the inputfield on the admin side), so this is not possible anymore:

"$page->embed" // returns the url instead

Also two notes: I don’t know how the search handles Pagefile/image’s custom field and something I saw when testing was that the customProviders json is never truly tested as the value at this stage is always the default one.

@romaincazier
Copy link
Author

Actually I figured a way to have __toString() to return the html while having the inputfield work as expected, this way it should be a non-breaking update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant