Skip to content

Commit 6746b1f

Browse files
committed
Add configured oEmbed query parameters to all oEmbed endpoints
1 parent af0df40 commit 6746b1f

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/OEmbed.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,22 @@ protected function detectEndpoint(): ?UriInterface
5353
{
5454
$document = $this->extractor->getDocument();
5555

56-
return $document->link('alternate', ['type' => 'application/json+oembed'])
56+
$endpoint = $document->link('alternate', ['type' => 'application/json+oembed'])
5757
?: $document->link('alternate', ['type' => 'text/json+oembed'])
5858
?: $document->link('alternate', ['type' => 'application/xml+oembed'])
5959
?: $document->link('alternate', ['type' => 'text/xml+oembed'])
60-
?: $this->detectEndpointFromProviders();
60+
?: null;
61+
62+
if ($endpoint === null) {
63+
return $this->detectEndpointFromProviders();
64+
}
65+
66+
// Add configured OEmbed query parameters
67+
parse_str($endpoint->getQuery(), $query);
68+
$query = array_merge($query, $this->extractor->getSetting('oembed:query_parameters') ?? []);
69+
$endpoint = $endpoint->withQuery(http_build_query($query));
70+
71+
return $endpoint;
6172
}
6273

6374
private function detectEndpointFromProviders(): ?UriInterface

0 commit comments

Comments
 (0)