- Issue created by @andypost
- Status changed to Needs review
almost 2 years ago 4:47pm 19 February 2023 - 🇫🇷France andypost
CR and initial patch, as there's contrib usage CR needs to be updated for
Url::renderAccess()
(marked@internal
ATM) - 🇫🇷France andypost
+++ b/core/modules/shortcut/src/Form/SetCustomize.php @@ -55,7 +55,9 @@ public function form(array $form, FormStateInterface $form_state) { - ] + $url->toRenderArray(); + '#url' => $url, + '#options' => $url->getOptions(),
There's access check few lines above so no need for
$render_array['#access_callback'] = [get_class(), 'renderAccess'];
- 🇬🇧United Kingdom catch
I checked the contrib usages, they are all doing:
if ($url->renderAccess($url->toRenderArray()))
Which seems like an extremely long way to do:
if ($url->access())
There are only two modules with a couple of usages each, so I think we could go ahead and deprecate both methods here.
- 🇫🇷France andypost
Updated CR https://www.drupal.org/node/3342977 →
and new patch with todo link for removal 📌 [11.x] Remove deprecated code from \Drupal\Core\Url Active
- Status changed to Needs work
almost 2 years ago 11:20pm 20 February 2023 - 🇬🇧United Kingdom catch
-
+++ b/core/lib/Drupal/Core/Url.php @@ -770,8 +770,14 @@ public function toString($collect_bubbleable_metadata = FALSE) { + @trigger_error('The ' . __METHOD__ . '() is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Use to inline its implementation. See https://www.drupal.org/node/3342977', E_USER_DEPRECATED);
Maybe 'There is no direct replacement' instead of 'inline its implementation? - The uses in contrib should be refactored to something else entirely.
-
+++ b/core/lib/Drupal/Core/Url.php @@ -836,8 +842,14 @@ public function access(AccountInterface $account = NULL, $return_as_object = FAL public static function renderAccess(array $element) { + @trigger_error('The ' . __METHOD__ . '() is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Use to inline its implementation. See https://www.drupal.org/node/3342977', E_USER_DEPRECATED); return $element['#url']->access();
Same here.
-
- Status changed to Needs review
almost 2 years ago 7:49am 21 February 2023 - Status changed to RTBC
almost 2 years ago 10:14am 21 February 2023 - 🇬🇧United Kingdom catch
The example in the CR is clear and covers literally every usage in contrib.
I think this is ready to go now.
- 🇮🇳India rckstr_rohan
Reviewed Patch on #10, issue has been resolved as observed, can be merged.
- Status changed to Needs review
almost 2 years ago 3:11am 23 February 2023 - 🇳🇿New Zealand quietone
The deprecation message for a method → does not start with 'The'. And I was getting a phpcs errors. So, I updated the patch.
I also too the liberty of removing 'direct' from the deprecation message. It did not seem to be adding information.
- Status changed to RTBC
almost 2 years ago 7:48am 23 February 2023 - 🇫🇷France andypost
Thank you, curious why phpcs does not report it in CI
-
longwave →
committed 95bae2b6 on 10.1.x
Issue #3342975 by andypost, quietone, catch: Deprecate Url::...
-
longwave →
committed 95bae2b6 on 10.1.x
- Status changed to Fixed
almost 2 years ago 8:10pm 12 March 2023 - 🇬🇧United Kingdom longwave UK
Committed and pushed to 10.1.x, thanks!
Automatically closed - issue fixed for 2 weeks with no activity.
- Status changed to Fixed
about 1 year ago 11:28am 18 October 2023 - 🇪🇸Spain pcambra Asturies
I know I'm late to the party, but why is toRenderArray deprecated? I only see the access method discussed.