- Issue created by @ultimike
- First commit to issue fork.
- 🇮🇪Ireland lostcarpark
The tests for "previous_major" are run against Drupal 9.5, so that is the oldest version I would confidently say Smart Trim will work against.
I added the following to another module that wasn't willing to drop D9 support yet:
if (version_compare(\Drupal::VERSION, '10.1.0') >= 0) { // Drupal 10.1 or later, use DeprecationHelper. // Note, put back named parameters when we drop support for Drupal 9.5. $output = DeprecationHelper::backwardsCompatibleCall( \Drupal::VERSION, '10.3', fn() => \Drupal::service('renderer')->renderInIsolation($build), fn() => \Drupal::service('renderer')->renderPlain($build), ); } else { // Remove when we drop support for < Drupal 10.1. // @phpstan-ignore-next-line $output = \Drupal::service('renderer')->renderPlain($build); }
It's a little bit hacky, especially since D9 needs to support PHP 7.4, so I had to remove named parameters from the DeprecationHelper. Hopefully we'll drop D9 support and remove the if() wrapper.
- 🇺🇸United States markie Albuquerque, NM
Merged in an update that dropped <9.5 support for the next release.
- 🇮🇳India ankitv18
Hi,
I've updated the MR with replacing the logic of implementing renderPlain deprecation with the below code block.if (method_exists(RendererInterface::class, 'renderPlain')) { // @phpstan-ignore-next-line as it is deprecated in D10.3 and removed from D12. $field_output_renderer = \Drupal::service('renderer')->renderPlain($field_output); } else { $field_output_renderer = \Drupal::service('renderer')->renderInIsolation($field_output); }
Pros:
- Support below D10
- Handles both renderPlain and renderInIsolation without deprecationHelper class.
cc: @markie @ultimike
- Status changed to Fixed
5 months ago 6:32pm 4 August 2024 - 🇺🇸United States ultimike Florida, USA
Thanks @lostcarpark and @ankitv18 - I'm closing this issue as the fix is part of ✨ Smart Trim Tokens for text with summary fields Needs review .
-mike
Automatically closed - issue fixed for 2 weeks with no activity.