You are here

WebformUiPathProcessor.php in Webform 8.5

Same filename and directory in other branches
  1. 6.x modules/webform_ui/src/PathProcessor/WebformUiPathProcessor.php

File

modules/webform_ui/src/PathProcessor/WebformUiPathProcessor.php
View source
<?php

namespace Drupal\webform_ui\PathProcessor;

use Drupal\Core\PathProcessor\OutboundPathProcessorInterface;
use Drupal\Core\Render\BubbleableMetadata;
use Symfony\Component\HttpFoundation\Request;

/**
 * Path processor for webform UI.
 */
class WebformUiPathProcessor implements OutboundPathProcessorInterface {

  /**
   * {@inheritdoc}
   */
  public function processOutbound($path, &$options = [], Request $request = NULL, BubbleableMetadata $bubbleable_metadata = NULL) {
    if (is_null($request) || strpos($path, '/webform/') === FALSE) {
      return $path;
    }
    if (strpos($request
      ->getQueryString(), '_wrapper_format=') === FALSE) {
      return $path;
    }
    $querystring = [];
    parse_str($request
      ->getQueryString(), $querystring);
    if (empty($querystring['destination'])) {
      return $path;
    }
    $destination = $querystring['destination'];
    $options['query']['destination'] = $destination;
    return $path;
  }

}

Classes

Namesort descending Description
WebformUiPathProcessor Path processor for webform UI.