You are here

public static function FieldUI::getNextDestination in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/field_ui/src/FieldUI.php \Drupal\field_ui\FieldUI::getNextDestination()

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.

6 calls to FieldUI::getNextDestination()
FieldConfigEditForm::save in core/modules/field_ui/src/Form/FieldConfigEditForm.php
Form submission handler for the 'save' action.
FieldStorageAddForm::submitForm in core/modules/field_ui/src/Form/FieldStorageAddForm.php
Form submission handler.
FieldStorageConfigEditForm::save in core/modules/field_ui/src/Form/FieldStorageConfigEditForm.php
Form submission handler for the 'save' action.
FieldUiTest::testGetNextDestination in core/modules/field_ui/tests/src/Unit/FieldUiTest.php
@covers ::getNextDestination
FieldUiTest::testGetNextDestinationEmpty in core/modules/field_ui/tests/src/Unit/FieldUiTest.php
@covers ::getNextDestination

... See full list

File

core/modules/field_ui/src/FieldUI.php, line 46
Contains \Drupal\field_ui\FieldUI.

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;
}