Problem/Motivation
Spotted use of some deprecated methods during module upgrade.
Proposed resolution
Changes in drupalmoduleupgrader.grep.yml:
function_calls:
check_plain: '\Drupal\Component\Utility\SafeMarkup::checkPlain'to
function_calls:
check_plain: '\Drupal\Component\Utility\Html::escape'However this may cause "double escaping" as highlighted here: #2549395: SafeMarkup methods are removed in "Escaping markup" - "Twig" section.
Remaining tasks
1. Is double escaping above ok or does it need an associated comment and link to this change record?
2. Should format_date be changed to use a formatter with the same arguments rather than the advised service from format_date documentation.
i.e.
format_interval: '\Drupal::service("date.formatter")->formatInterval'
or
format_interval: '\Drupal\Core\Datetime\DateFormatter::format'
The latter has the same arguments and seems the right choice to me. Does this require a comment in code also to recommend using the service?
User interface changes
N/A
API changes
Depends on choices in the "Remaining Tasks" above.
Data model changes
N/A (None that I'm aware of)
Original report by [mccrodp]
N/A
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | drupalmoduleupgrader-remove-calls-to-deprecated-methods-1155816-2-d8.patch | 706 bytes | mccrodp |
Comments
Comment #2
mccrodp commentedPatch includes change from
SafeMarkup::checkPlaintoHtml::escapeonly.Comment #3
webchickAwesome stuff, thank you!
Committed and pushed to 8.x-1.x. Thanks!