You are here

protected function Embed::init in CMS Content Sync 2.1.x

Same name and namespace in other branches
  1. 2.0.x src/Controller/Embed.php \Drupal\cms_content_sync\Controller\Embed::init()
6 calls to Embed::init()
Embed::flowForm in src/Controller/Embed.php
Embed::migrate in src/Controller/Embed.php
Embed::nodeStatus in src/Controller/Embed.php
Embed::pullDashboard in src/Controller/Embed.php
Embed::site in src/Controller/Embed.php

... See full list

File

src/Controller/Embed.php, line 192

Class

Embed
Class Embed provides helpers to embed Sync Core functionality into the site.

Namespace

Drupal\cms_content_sync\Controller

Code

protected function init($expectJwtWithSyncCoreUrl = false) {
  $this->params = \Drupal::request()->query
    ->all();
  if ($expectJwtWithSyncCoreUrl) {
    if (isset($this->params['uuid'], $this->params['jwt'])) {
      $tks = explode('.', $this->params['jwt']);
      list(, $bodyb64) = $tks;
      $payload = JWT::jsonDecode(JWT::urlsafeB64Decode($bodyb64));
      if (!empty($payload->syncCoreBaseUrl)) {
        DrupalApplication::get()
          ->setSyncCoreUrl($payload->syncCoreBaseUrl);
      }
    }
  }
  $this->core = SyncCoreFactory::getDummySyncCoreV2();
  $this->settings = ContentSyncSettings::getInstance();
  $this->embedService = $this->core
    ->getEmbedService();
}