Skip to content
Snippets Groups Projects
Commit 3fd8ac14 authored by Sadashiv Dalvi's avatar Sadashiv Dalvi
Browse files

Allow setting scope using constant and url both

parent a15ae4dd
Branches
Tags 8.x-3.0-rc2
No related merge requests found
......@@ -2,6 +2,7 @@
namespace Drupal\google_api_client\Entity;
use Drupal\Component\Utility\UrlHelper;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\Core\Entity\ContentEntityBase;
......@@ -272,9 +273,17 @@ class GoogleApiClient extends ContentEntityBase implements GoogleApiClientInterf
$merged_scopes = [];
foreach ($scopes as $scope) {
foreach ($all_scopes as $scopes) {
if (in_array($scope, $scopes)) {
$merged_scopes[] = array_search($scope, $scopes);
break;
if (UrlHelper::isValid($scope, TRUE)) {
if (in_array($scope, $scopes)) {
$merged_scopes[] = array_search($scope, $scopes);
break;
}
}
else {
if (in_array($scope, array_keys($scopes))) {
$merged_scopes[] = $scope;
break;
}
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment