Updated: Comment #0

Problem/Motivation

sun rightfully complained in #1996238: Replace hook_library_info() by *.libraries.yml file that the Text Editor module's library definitions contain a setting that is dynamically generated, which violates the immutability principle of libraries.

While working on removing this, I noticed that this setting was nonessential: thanks to Drupal.url() we can generate this URL on the client-side! That both fixes this problem and results in less data on the wire! We already use this technique in many other places in Drupal core.

Proposed resolution

Use Drupal.url() instead of drupalSettings.

Remaining tasks

None.

User interface changes

None.

API changes

None.

Comments

wim leers’s picture

Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new1.61 KB
nod_’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +JavaScript

That works :)

sun’s picture

If possible, it would be great to defer these commits on #1996238: Replace hook_library_info() by *.libraries.yml file, because that one is an utter pain to re-roll.

wim leers’s picture

#3 is not yet ready, and it allows you to simply *remove* several hunks from that patch, so I respectfully disagree.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

#1996238: Replace hook_library_info() by *.libraries.yml file was already broken by it looks like many other things, so will need a re-roll in any event. Getting this one in in the meantime.

Committed and pushed to 8.x. Thanks!

wim leers’s picture

Issue tags: -sprint

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.