Closed (fixed)
Project:
Customers Canvas
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
9 Mar 2018 at 15:35 UTC
Updated:
2 Apr 2018 at 19:39 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
joshmillerComment #3
joshmillerIncludes:
Comment #4
heddnPass Drupal and possibly jQuery into the js, Then alias them as Drupal and $ inside the script. It makes for easier debugging of JS later on. See https://www.drupal.org/docs/7/api/javascript-api/managing-javascript-in-... as an example.
The recommended way to add JS in D7 is via hook_page_build and add it as an #attached element. I think you can do the path checking in there instead. Or alternatively, attach it to the theme element rendered on the specific menu path.
Why? what if someone wants to print things and they are using drush (which doesn't have any urls) or in a test path. This would essentially block that.
Comment #5
joshmillerResolved all feedback, I think.
Comment #6
joshmillerGenerify this comment, number of arguments is in flux for now.
Whoops, unfinished thought there.
Comment #7
joshmillerComment #8
joshmillerBetter interdiff
Comment #9
heddnThis is weird. Can we check for empty or at least check for === for NULL?
single quotes more typical.
Pass Drupal in as well. It would look like:
This tightly couples the theme layer to your js. And means the builder can only be printed a single time on a page. If that is acceptable, then proceed.
Comment #11
joshmillerThanks for the feedback, as always Lucas :)