The documentation for the FormState::setRedirect()'s $options parameter says:

array $options: (optional) An associative array of additional options. See \Drupal\Core\Url for the available keys.

\Drupal\Core\Url is the documentation page that describes the \Drupal\Core\Url class, but it doesn't say much about the options that can be used.

The description of $options should be the following one.

array $options: (optional) An associative array of additional options. See Url::fromUri() for the available keys.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

joachim created an issue. See original summary.

shailja179’s picture

Assigned: Unassigned » shailja179

Hi @joachim,
Which information do you need for url options? Please elaborate with steps.
Thanks

shailja179’s picture

Assigned: shailja179 » Unassigned
joachim’s picture

Issue summary: View changes

Expanded the IS.

shailja179’s picture

@joachim, You can use below things in options parameter.

$options = array('attributes' =>['target' => '_blank']);( target could be self, _blank) 
$options = ['absolute' => TRUE]; (True if path is absolute otherwise false) 

Let me know if this helps.

apaderno’s picture

@shailja179 joachim is pointing out that the link given in An associative array of additional options. See \Drupal\Core\Url for the available keys. doesn't take to a page explaining what options can be used. It points to a class documentation page, where nothing is said about those options.

apaderno’s picture

Title: docs for FormState::setRedirect() $options param don't send you somewhere useful » The link given in FormState::setRedirect() for the page explaining what values are available for $options param takes to a class documentation page
Issue summary: View changes
Issue tags: +Novice

I made more explicit what the suggested change is.

shailja179’s picture

I have uploaded the patch to fix this incorrect information.
Please check this patch.

shailja179’s picture

Status: Active » Needs review
joachim’s picture

Status: Needs review » Reviewed & tested by the community

Looks good.

Thanks for the patch!

apaderno’s picture

Nitpicking: See can stay on the previous line, where it originally was.

-   *   (optional) An associative array of additional options. See
-   *   \Drupal\Core\Url for the available keys.
+   *   (optional) An associative array of additional options.
+   *   See \Drupal\Core\Url::fromUri() for the available keys.
shailja179’s picture

Added fixed patch.Please check.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

Let's improve this one step further and add an @see \Drupal\Core\Url::fromUri() to the @see section - that way someone can click on that in their IDE of choice and be taken there.

ravi.shankar’s picture

Status: Needs work » Needs review
FileSize
871 bytes
882 bytes
apaderno’s picture

I would use the following patch, which makes more explicit what the users need to look for in the linked page (and it adds the @see tag as requested).

ravi.shankar’s picture

Status: Needs review » Needs work

Changed status to needs work as patch #15 didn't apply.

davidhernandez’s picture

Not sure what changed (chunk size changed) from then to now but I just pulled updates so I would assume applies ok.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

tanubansal’s picture

Tested #17 on 9.1, its working fine
This can be moved to RTBC

joachim’s picture

Status: Needs review » Reviewed & tested by the community

LGTM.

Thanks everyone!

alexpott’s picture

Version: 9.2.x-dev » 8.9.x-dev
Status: Reviewed & tested by the community » Fixed

Committed and pushed d6b4ca71b6 to 9.2.x and ecb9c5029f to 9.1.x and caa0f61ada to 9.0.x and 2c50387f33 to 8.9.x. Thanks!

Backported to 8.9.x as this docs fix is helpful there too.

  • alexpott committed d6b4ca7 on 9.2.x
    Issue #3157963 by shailja179, ravi.shankar, kiamlaluno, davidhernandez,...

  • alexpott committed ecb9c50 on 9.1.x
    Issue #3157963 by shailja179, ravi.shankar, kiamlaluno, davidhernandez,...

  • alexpott committed caa0f61 on 9.0.x
    Issue #3157963 by shailja179, ravi.shankar, kiamlaluno, davidhernandez,...

  • alexpott committed 2c50387 on 8.9.x
    Issue #3157963 by shailja179, ravi.shankar, kiamlaluno, davidhernandez,...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.