Skip to content

Commit

Permalink
Merge pull request #49 from wrav/alpha
Browse files Browse the repository at this point in the history
1.3.4 - GraphQL fixes
  • Loading branch information
reganlawton authored Jun 29, 2020
2 parents a785046 + e0b0ffe commit 51f2b23
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# oEmbed Changelog

## 1.3.4 - 2020-06-29

### Updated
- Fix to normalizeValue function on GraphQL field's `__get()` magic method. Thanks @joshuabaker

## 1.3.3 - 2020-06-29

### Updated
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ You can access additional media details using the examples below.

Additional Embed information can be found [here](https://github.com/oscarotero/Embed)

## GraphQl
## GraphQL

I recommend enabling caching in the plugin settings menu to speed up the API resolve timing.

Expand Down Expand Up @@ -123,4 +123,4 @@ Changes can be viewed [here](https://github.com/wrav/oembed/blob/master/CHANGELO

## Support

Get in touch via email or by [creating a Github issue](/wrav/oembed/issues)
Get in touch via email, Discord, or by [creating a Github issue](/wrav/oembed/issues)
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "wrav/oembed",
"description": "A simple plugin to extract media information from websites, like youtube videos, twitter statuses or blog articles.",
"type": "craft-plugin",
"version": "1.3.3",
"version": "1.3.4",
"keywords": [
"craft",
"cms",
Expand Down
8 changes: 7 additions & 1 deletion src/fields/OembedField.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,13 @@ public function getContentGqlType()
*/
public function normalizeValue($value, ElementInterface $element = null)
{
if (is_string($value) && $decValue = json_decode($value, true)) {
if (is_array($value)) {
if (isset($value['url'])) {
return new OembedModel($value['url']);
}
}

if (is_string($value) && $decValue = json_decode($value, true)) {
if (isset($decValue['url'])) {
return new OembedModel($decValue['url']);
}
Expand Down
1 change: 0 additions & 1 deletion src/gql/OembedFieldResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

class OembedFieldResolver extends ObjectType
{

/**
* @inheritdoc
*/
Expand Down

0 comments on commit 51f2b23

Please sign in to comment.