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.
This issue is a follow up for the issue: #1704864: Add a "Required" and "Show by default" option for "Text area with a summary" field/widget.
The javascript file "text.js" file should be declared with hook_library_info in the text module.
Comment | File | Size | Author |
---|---|---|---|
#9 | 1888744-9-text-missing-library-hook.patch | 1.64 KB | nick_schuch |
#9 | 1888744-interdiff.txt | 426 bytes | nick_schuch |
#7 | 1888744-7-text-missing-library-hook.patch | 1.64 KB | nick_schuch |
#7 | 1888744-interdiff.txt | 418 bytes | nick_schuch |
#4 | Screen Shot 2013-01-15 at 11.18.49 AM.png | 23.16 KB | larowlan |
Comments
Comment #1
larowlanInline with #1737148: Explicitly declare all JS dependencies, don't use drupal_add_js
File should be declared as a library with dependency on jquery and attached using library, instead of js.
Comment #2
nick_schuch CreditAttribution: nick_schuch commentedInitial patch containing:
- Creation of hook.
- Update of text.js reference.
Comment #3
nick_schuch CreditAttribution: nick_schuch commentedComment #4
larowlanTested manually, looks good to me
Screenshots
Note this will conflict with #1704864: Add a "Required" and "Show by default" option for "Text area with a summary" field/widget. so one of the two will need a re-roll. Probably better to make it this one as the other is a larger patch.
Comment #5
larowlan@nod_ pointed out we need the jquery.once dependency too
Comment #6
larowlanand also, we don't need the jquery.form dependency
Comment #7
nick_schuch CreditAttribution: nick_schuch commentedHave updated the patch with the refined dependancies.
Comment #8
nod_it's jquery.once the dependency name, not drupal.once :)
Comment #9
nick_schuch CreditAttribution: nick_schuch commentedWoops. Thanks nod_!
Comment #10
larowlanGood to go
Comment #11
webchickCommitted and pushed to 8.x, thanks!
However, I'm wondering if we need to put some babysitting code in here. This is at least the 3rd or 4th time we've caught one of these. If hook_library_info() is actually supposed to be required, it seems like we ought to throw a notice or something when a library is accessed out of band? Could we open up a follow-up (if it doesn't already exist) to discuss?
Comment #12
webchickComment #13
larowlanFollow up is #1890912: Consider possibility of throwing a warning when js is attached without a library (and assoc dependency chain).