Replace MailFormatHelper::htmlToMailUrls() with a self-contained method used from MailFormatHelper::htmlToText() in the same way it uses MailFormatHelper::htmlToTextPad()

Created on 25 December 2017, about 7 years ago
Updated 22 February 2023, almost 2 years ago

MailFormatHelper::htmlToText() is using a static method as callback for preg_replace_callback().

That method can be replaced with a method that replaces the <a> tags using a closure, and that is called from MailFormatHelper::htmlToText() in the same way it uses MailFormatHelper::htmlToTextPad().

This would allow to:

  • Remove those class static properties used just to pass values between the preg_replace_callback()
    callback and MailFormatHelper::htmlToText()
  • Simplify the preg_replace_callback() callback code, since it would just called from preg_replace_callback()
📌 Task
Status

Needs work

Version

10.1

Component
Mail 

Last updated 19 days ago

No maintainer
Created by

🇮🇹Italy apaderno Brescia, 🇮🇹

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • The Needs Review Queue Bot tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

    Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.

    Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

  • 🇮🇳India pooja saraah Chennai

    Fixed failed commands on #28
    Attached patch against Drupal 10.1.x
    Attached reroll patch

  • Status changed to Needs review almost 2 years ago
  • Status changed to Needs work almost 2 years ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
    +    @trigger_error('MailFormatHelper::htmlToMailUrls() is deprecated in Drupal 8.5.0 and will be removed before Drupal 9.0.0. Instead, you should use \Drupal\Core\Mail\MailFormatHelper::htmlToTextUrls(). See https://www.drupal.org/node/2932899.', E_USER_DEPRECATED);
    

    The deprecation message should mention Drupal 10 and Drupal 11, as the added comments do, for example the following one.

    +   * @deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Instead, use
    +   *   \Drupal\Core\Mail\MailFormatHelper::htmlToTextUrls().
    
  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    The last patch fixed what I reported in my previous comment. Let's see if the tests pass.

Production build 0.71.5 2024