By smustgrave on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
10.2.x
Introduced in version:
10.2.0
Issue links:
Description:
2 new functions have been added to the FormStateInterface
/**
* Determines whether the redirect respects the destination query parameter.
*
* @param bool $status
* (optional) TRUE if the redirect should take precedence over the
* destination query parameter. FALSE if not. Defaults to TRUE.
*
* @return $this
*/
public function setIgnoreDestination(bool $status = TRUE);
/**
* Gets whether the redirect respects the destination query parameter.
*
* @return bool
* TRUE if the redirect should take precedence over the destination query
* parameter.
*/
public function getIgnoreDestination(): bool;
Now it's possible to ignore the destination URL parameter in the form_state
Example
$form_state->setRedirect(
'block.admin_add',
[
'plugin_id' => 'block_content:' . $block->uuid(),
'theme' => $theme,
]
);
$form_state->setIgnoreDestination();
Impacts:
Site builders, administrators, editors
Module developers
Themers