You are here

public function Embed::flowEditForm in CMS Content Sync 2.1.x

1 string reference to 'Embed::flowEditForm'
cms_content_sync.routing.yml in ./cms_content_sync.routing.yml
cms_content_sync.routing.yml

File

src/Controller/Embed.php, line 131

Class

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

Namespace

Drupal\cms_content_sync\Controller

Code

public function flowEditForm(Flow $cms_content_sync_flow) {
  if ($cms_content_sync_flow->variant === Flow::VARIANT_PER_BUNDLE) {
    $request = \Drupal::request();

    // Drupal is a little funny in that it will ignore whatever you pass to the redirect response and
    // instead use the destination query parameter if given. So we have to remove it.
    if ($request->query
      ->get('destination')) {
      $destination = $request->query
        ->get('destination');
      $request->query
        ->remove('destination');
    }
    return RedirectResponse::create(Url::fromRoute('entity.cms_content_sync_flow.edit_form_advanced', [
      'cms_content_sync_flow' => $cms_content_sync_flow->id,
    ], [
      'absolute' => true,
      'query' => empty($destination) ? [] : [
        'destination' => $destination,
      ],
    ])
      ->toString());
  }
  return $this
    ->flowForm($cms_content_sync_flow);
}