FieldUI::getNextDestination

public static FieldUI::getNextDestination(array $destinations)

Returns the next redirect path in a multipage sequence.

Parameters

array $destinations: An array of destinations to redirect to.

Return value

\Drupal\Core\Url|null The next destination to redirect to.

File

core/modules/field_ui/src/FieldUI.php, line 41

Class

FieldUI
Static service container wrapper for Field UI.

Namespace

Drupal\field_ui

Code

public static function getNextDestination(array $destinations) {
  // If there are no valid destinations left, return here.
  if (empty($destinations)) {
    return NULL;
  }

  $next_destination = array_shift($destinations);
  if (is_array($next_destination)) {
    $next_destination['options']['query']['destinations'] = $destinations;
    $next_destination += array(
      'route_parameters' => array(),
    );
    $next_destination = Url::fromRoute($next_destination['route_name'], $next_destination['route_parameters'], $next_destination['options']);
  }
  else {
    $options = UrlHelper::parse($next_destination);
    if ($destinations) {
      $options['query']['destinations'] = $destinations;
    }
    // Redirect to any given path within the same domain.
    // @todo Revisit this in https://www.drupal.org/node/2418219.
    $next_destination = Url::fromUserInput('/' . $options['path'], $options);
  }
  return $next_destination;
}
doc_Drupal
2016-10-29 09:12:52
Comments
Leave a Comment

Please login to continue.