Skip to content

Commit

Permalink
feat(next): dynamic consumer paths
Browse files Browse the repository at this point in the history
Provides dynamic consumer paths from generated URL using Consumer
collection route.

fixes chapter-three#615
  • Loading branch information
mglaman committed Dec 7, 2023
1 parent 278bd1e commit f33eaa9
Showing 1 changed file with 4 additions and 2 deletions.
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

0 comments on commit f33eaa9

Please sign in to comment.