function FieldUI::getNextDestination

Same name in other branches
  1. 9 core/modules/field_ui/src/FieldUI.php \Drupal\field_ui\FieldUI::getNextDestination()
  2. 8.9.x core/modules/field_ui/src/FieldUI.php \Drupal\field_ui\FieldUI::getNextDestination()
  3. 10 core/modules/field_ui/src/FieldUI.php \Drupal\field_ui\FieldUI::getNextDestination()

Returns the next redirect path in a multi-page sequence.

Parameters

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

Return value

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

5 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.
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
FieldUiTest::testGetNextDestinationRouteName in core/modules/field_ui/tests/src/Unit/FieldUiTest.php
@covers ::getNextDestination

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 += [
            'route_parameters' => [],
        ];
        $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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.