function BlockEntitySettingTrayForm::successfulAjaxSubmit

Same name in other branches
  1. 9 core/modules/settings_tray/src/Block/BlockEntitySettingTrayForm.php \Drupal\settings_tray\Block\BlockEntitySettingTrayForm::successfulAjaxSubmit()
  2. 10 core/modules/settings_tray/src/Block/BlockEntitySettingTrayForm.php \Drupal\settings_tray\Block\BlockEntitySettingTrayForm::successfulAjaxSubmit()
  3. 11.x core/modules/settings_tray/src/Block/BlockEntitySettingTrayForm.php \Drupal\settings_tray\Block\BlockEntitySettingTrayForm::successfulAjaxSubmit()

Overrides AjaxFormHelperTrait::successfulAjaxSubmit

File

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

Class

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

Namespace

Drupal\settings_tray\Block

Code

protected function successfulAjaxSubmit(array $form, FormStateInterface $form_state) {
    if ($redirect_url = $this->getRedirectUrl()) {
        $command = new RedirectCommand($redirect_url->setAbsolute()
            ->toString());
    }
    else {
        // Settings Tray always provides a destination.
        throw new \Exception("No destination provided by Settings Tray form");
    }
    $response = new AjaxResponse();
    return $response->addCommand($command);
}

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