diff --git a/src/Plugin/MediaEntity/Type/Pinterest.php b/src/Plugin/MediaEntity/Type/Pinterest.php index 7153c0e..1ee510e 100644 --- a/src/Plugin/MediaEntity/Type/Pinterest.php +++ b/src/Plugin/MediaEntity/Type/Pinterest.php @@ -114,29 +114,26 @@ class Pinterest extends MediaTypeBase { public function getField(MediaInterface $media, $name) { $matches = $this->matchRegexp($media); - if (!empty($matches)) { - $matches = reset($matches); - } - else { + if (empty($matches)) { return FALSE; } // First we return the fields that are available from regex. switch ($name) { case 'id': - if ($matches['id']) { + if (!empty($matches['id'])) { return $matches['id']; } return FALSE; case 'board': - if ($matches['slug']) { + if (!empty($matches['slug'])) { return $matches['slug']; } return FALSE; case 'user': - if ($matches['username']) { + if (!empty($matches['username'])) { return $matches['username']; } return FALSE;