You are here

protected function Embed::run 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::run()
6 calls to Embed::run()
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 214

Class

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

Namespace

Drupal\cms_content_sync\Controller

Code

protected function run($embed, $extras = []) {
  $result = $embed
    ->run();
  $redirect = $result
    ->getRedirectUrl();
  if ($redirect) {
    return RedirectResponse::create($redirect);
  }
  $html = $result
    ->getRenderedHtml();

  // TODO: Put this in a theme file.
  return [
    '#type' => 'inline_template',
    '#template' => '<div className="content-sync-embed-wrapper" style="margin-top: 20px;">{{ html|raw }}</div>',
    '#context' => [
      'html' => $html,
    ],
  ] + $extras;
}