You are here

protected function BlockEntitySettingTrayForm::getRedirectUrl in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/settings_tray/src/Block/BlockEntitySettingTrayForm.php \Drupal\settings_tray\Block\BlockEntitySettingTrayForm::getRedirectUrl()
  2. 9 core/modules/settings_tray/src/Block/BlockEntitySettingTrayForm.php \Drupal\settings_tray\Block\BlockEntitySettingTrayForm::getRedirectUrl()

Gets the form's redirect URL from 'destination' provide in the request.

Return value

\Drupal\Core\Url|null The redirect URL or NULL if dialog should just be closed.

1 call to BlockEntitySettingTrayForm::getRedirectUrl()
BlockEntitySettingTrayForm::successfulAjaxSubmit in core/modules/settings_tray/src/Block/BlockEntitySettingTrayForm.php
Allows the form to respond to a successful AJAX submission.

File

core/modules/settings_tray/src/Block/BlockEntitySettingTrayForm.php, line 166

Class

BlockEntitySettingTrayForm
Provides form for block instance forms when used in the off-canvas dialog.

Namespace

Drupal\settings_tray\Block

Code

protected function getRedirectUrl() {

  // \Drupal\Core\Routing\RedirectDestination::get() cannot be used directly
  // because it will use <current> if 'destination' is not in the query
  // string.
  if ($this
    ->getRequest()->query
    ->has('destination') && ($destination = $this
    ->getRedirectDestination()
    ->get())) {
    return Url::fromUserInput('/' . $destination);
  }
}