Problem/Motivation
Currently the 2.x version this module will attempt to embed any url to any provider in the provider repository
Often you don't want your filter to embed every type of url that has a provider. You probably want to restrict you filter to only use certain providers.
Soembed should have a setting on the filter instance to select which providers to enable.
Listing all the possible providers as checkboxes would make a huge list of items and a pain to manage.
Proposed resolution
The oembed_providers module (https://www.drupal.org/project/oembed_providers) allows admins to create groups of enabled providers (buckets)
If oembed_providers is enabled, soembed should list these buckets on the filters settings form, and only the providers enabled in the selected buckets should be embedded with the filter.
I have made a patch that attempts to do this.
If the oembed_providers module is not installed or no buckets are enabled on the filter, it defaults to the original behavior of embedding any url.
I've tested this with oembed_providers 2.x-dev
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | soembed--check-provider-followup--3260982--15.patch | 4.94 KB | loze |
| #7 | soembed-providers-config-3260982-7.patch | 6.1 KB | loze |
Issue fork soembed-3260982
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
loze commentedComment #3
loze commentedThis patch cleans it up a bit as well as adds a setting to bypass core medias embed frame and optionally add the embed code directly.
This also fixes #3199585: Notice: Undefined offset: 3 in Drupal\soembed\Plugin\Filter\SoEmbedFilter->embed()
Comment #4
loze commentedwasn't applying any longer, rerolled for beta2
Comment #5
WebbehWould love to see this included - oembed_providers is a great addition.
Comment #6
loze commentedheres a reroll for beta3
Comment #7
loze commentedThe previous patch had the schema config in the wrong directory. I also removed the code I had in there from #3 to bypass core medias embed iframe which is out of scope of this issue and I will raise in another issue.
This patch allows you to configure the oembed_providers buckets used for each input filter.
Comment #9
loze commentedThanks for committing this.
After using it for a while I noticed that if there are many urls in the field ,and some are not oembed urls, or some are dead urls that go nowhere, the call to getProviderByUrl() still attempts to ping the url even if its not in the provider repository. This causes a big performance hit when filtering the text.
We should have our own method in the filter that checks if the url is a known provider and return early if it is not.
I have a follow up patch for this coming.
Comment #11
loze commentedI don't think I did this right. Im still trying to get a hang of the issue forks on here. I was trying to post these changes
https://git.drupalcode.org/issue/soembed-3260982/-/commit/c4f42eda18492a...
Not sure where I went wrong. My apologies for the mess.
This adds a private method to the filter for getProviderByUrl() that only checks the known providers without trying to get the url.
Comment #12
ki commentedCould you make a cleaned-up MR or post a patch file?
Thanks.
Comment #14
loze commentedComment #15
loze commentedSorry about all that. Here is a patch.
Comment #18
ki commentedReleased in 8.x-2.0-beta6
Comment #19
ki commented