Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The following functions have been refactored into methods on the NestedArray class, all calls should be replaced with direct calls to the methods the wrappers are calling:
drupal_merge_js_settings($settings_items)
becomes \Drupal\Component\Utility\NestedArray::mergeDeepArray($settings_items, TRUE)
(note the extra parameter)
drupal_merge_attached()
becomes \Drupal\Component\Utility\NestedArray::mergeDeep()
Comments
Comment #1
ianthomas_ukComment #2
ianthomas_ukThis will be a small patch and will conflict with #2221755: Remove uses of deprecated Element functions, so let's do that one first.
Comment #3
ianthomas_ukThat patch is in.
These are new functions in 8.x, so don't need their own change record, but I have updated https://drupal.org/node/1911578 to refer to the NestedArray instead of drupal_merge_js_settings.
Comment #4
visabhishek CreditAttribution: visabhishek commentedi am uploading the initial patch, Please review...
Comment #6
vastav CreditAttribution: vastav commented4: drupal8.remove-uses-of-deprecated-drupal-merge-functions.2221773-04.patch queued for re-testing.
Comment #8
ianthomas_ukWe should rely on 'use' statements, rather than having the fully qualified class name everywhere.
Comments should wrap at 80 characters
I've not looked into what is causing the failure, but the failing test is very relevant to the code we're changing so it does look like a problem with the patch rather than the testbot (there may have been a different failure before the retest though).
Comment #9
sriharsha.uppuluri CreditAttribution: sriharsha.uppuluri commentedUpdated the patch based on #8
Comment #11
visabhishek CreditAttribution: visabhishek commentedupdated patch
Comment #13
vastav CreditAttribution: vastav commented11: drupal8.remove-uses-of-deprecated-drupal-merge-functions.2221773-11.patch queued for re-testing.
Comment #14
ParisLiakos CreditAttribution: ParisLiakos commentedafter applying the patch, i still find calls to
drupal_merge_attached
indrupal_pre_render_links
,_drupal_render_process_post_render_cache
anddrupal_render_collect_attached
Comment #15
visabhishek CreditAttribution: visabhishek commentedpatch updated as per #14 and drupal_merge_attached () is also removed from common.inc
Comment #16
ParisLiakos CreditAttribution: ParisLiakos commentedthanks!
i dont think we should remove drupal_merge_attached() itself in this issue though
Comment #17
visabhishek CreditAttribution: visabhishek commentedpatch update as per #16.
Comment #18
ParisLiakos CreditAttribution: ParisLiakos commentedthank you!
Comment #19
tstoeckler@Wim Leers was very adament about adding this as a separate function, so this should be left alone. At some point we should replace it with a non-procedural alternative, but that's for a separate issue.
Comment #20
ianthomas_ukThanks @tstockler. Actually he was adamant about having both functions as usability wrappers, see #2113015: Add drupal_merge_attached() function, to merge #attached assets, therefore this is a won't fix. Moving the wrappers into a class would be a separate issue.
I've changed the CR back to refer to the wrapper function.