Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(next): dynamic consumer paths #623

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
1 change: 1 addition & 0 deletions modules/next/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"drupal/subrequests": "^3.0"
},
"require-dev": {
"drupal/consumers": "^1.0",
"phpunit/phpunit": "^6.0 || ^7.0 || ^8.0 || ^9.0"
}
}
6 changes: 4 additions & 2 deletions modules/next/src/Controller/NextSiteEntityController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Drupal\next\Controller;

use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Url;
use Drupal\next\Entity\NextSiteInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Request;
Expand Down Expand Up @@ -56,10 +57,11 @@ public function environmentVariables(NextSiteInterface $next_site) {
'NEXT_IMAGE_DOMAIN' => $this->request->getHost(),
];

$path = Url::fromRoute('entity.consumer.collection')->toString();
$variables += [
'authentication_bearer' => '# Authentication',
'DRUPAL_CLIENT_ID' => 'Retrieve this from /admin/config/services/consumer',
'DRUPAL_CLIENT_SECRET' => 'Retrieve this from /admin/config/services/consumer',
'DRUPAL_CLIENT_ID' => 'Retrieve this from ' . $path,
'DRUPAL_CLIENT_SECRET' => 'Retrieve this from ' . $path,
];

if ($secret = $next_site->getPreviewSecret()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class NextSiteEntityControllerTest extends KernelTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = ['next'];
protected static $modules = ['consumers', 'next'];

/**
* The next_site entity.
Expand Down