Skip to content

Commit

Permalink
Amended conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuabaker authored May 28, 2021
1 parent 04ec9ef commit 6c2666d
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/fields/OembedField.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,17 @@ public function normalizeValue($value, ElementInterface $element = null)
}

// If array with `url` attribute, that’s our url so update the value
if ($url = ArrayHelper::getValue($value, 'url')) {
// Run `getValue` twice to avoid https://github.com/wrav/oembed/issues/74
$value = ArrayHelper::getValue($value, 'url', $url);
if (is_array($value)) {
$value = ArrayHelper::getValue($value, 'url');
}

// Run `getValue` twice to avoid https://github.com/wrav/oembed/issues/74
if (is_array($value)) {
$value = ArrayHelper::getValue($value, 'url');
}

// If URL string, return an instance of `OembedModel`
if (UrlHelper::isFullUrl($value)) {
if (is_string($value) && UrlHelper::isFullUrl($value)) {
return new OembedModel($value);
}

Expand Down

0 comments on commit 6c2666d

Please sign in to comment.