Skip to content

Commit

Permalink
Embed link types now create <iframe> elements when embed responses …
Browse files Browse the repository at this point in the history
…don’t contain them
  • Loading branch information
engram-design committed Feb 20, 2024
1 parent fc591a1 commit bd9f0db
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/links/Embed.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ public static function fetchEmbedData(string $url): array
...$image,
]));

// Flag an invalid embed URL - still a response, but no code
// If no embed code, create it
if (!trim($data['code'])) {
throw new Exception('Embed URL invalid.');
$data['code'] = '<iframe src="' . $info->url . '"></iframe>';
}

return $data;
Expand All @@ -101,9 +101,9 @@ public static function fetchEmbedData(string $url): array
'feeds' => $info->feeds,
]));

// Flag an invalid embed URL - still a response, but no code
// If no embed code, create it
if (!trim($data['code'])) {
throw new Exception('Embed URL invalid.');
$data['code'] = '<iframe src="' . $info->url . '"></iframe>';
}

return $data;
Expand Down

0 comments on commit bd9f0db

Please sign in to comment.